[tor-bugs] #20988 [Core Tor/Tor]: Test fgets_eagain fails on FreeBSD-amd64

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Feb 27 16:57:14 UTC 2017


#20988: Test fgets_eagain fails on FreeBSD-amd64
------------------------------------------------+--------------------------
 Reporter:  cypherpunks                         |          Owner:
     Type:  defect                              |         Status:
                                                |  needs_review
 Priority:  Medium                              |      Milestone:  Tor:
                                                |  0.3.1.x-final
Component:  Core Tor/Tor                        |        Version:
 Severity:  Normal                              |     Resolution:
 Keywords:  freebsd, tor-03-unspecified-201612  |  Actual Points:
Parent ID:                                      |         Points:
 Reviewer:                                      |        Sponsor:
------------------------------------------------+--------------------------

Comment (by cypherpunks):

 Replying to [comment:4 ahf]:
 > I've added a patch for this in
 https://gitlab.com/ahf/tor/commits/bugs/20988
 OP here. The changes look good but i haven't tested them. The inline patch
 fixes some small grammar nitpicks on commit
 [https://gitlab.com/ahf/tor/commit/49a4069d19877b24f00220fb41410445c804b463
 49a4069d19877b24f00220fb41410445c804b463].

 {{{
 diff --git a/src/common/compat.c b/src/common/compat.c
 index 771cc085d..753ad3f8f 100644
 --- a/src/common/compat.c
 +++ b/src/common/compat.c
 @@ -3480,7 +3480,7 @@ tor_getpass(const char *prompt, char *output, size_t
 buflen)
   * Upon successful completion, this function returns a pointer to the
 string
   * <b>str</b>. If EOF occurs before any characters are read the function
 will
   * return NULL and the content of <b>str</b> is unchanged. Upon error,
 the
 - * function return NULL and the caller must check for error using foef(3)
 and
 + * function returns NULL and the caller must check for error using
 foef(3) and
   * ferror(3).
   */
  char *
 @@ -3490,10 +3490,10 @@ tor_fgets(char *str, int size, FILE *stream)

    ret = fgets(str, size, stream);

 -  /* FreeBSD, OpenBSD, Linux (glibc), and Linux (musl) seems to disagree
 about
 +  /* FreeBSD, OpenBSD, Linux (glibc), and Linux (musl) seem to disagree
 about
     * what to do in the given situation. We check if the stream has been
 flagged
 -   * with an error-bit and retur NULL in that situation if errno is also
 set to
 -   * EAGAIN.
 +   * with an error-bit and return NULL in that situation if errno is also
 set
 +   * to EAGAIN.
     */
    if (ferror(stream) && errno == EAGAIN)
      return NULL;
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20988#comment:6>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list