This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17804] scandirat fails with ENOMEM because it checks for errno even if malloc succeeded


https://sourceware.org/bugzilla/show_bug.cgi?id=17804

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  72f29e3aab56cf9bd11d60ae351fbf9d5c709ada (commit)
       via  54e4efc2876b329ba80a6965a2583a906d99e694 (commit)
       via  f8aa69be445f65bb36cb3ae9291423600da7d6d2 (commit)
      from  2bd86632b7cb97dc9002a23795e140fc880e1987 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=72f29e3aab56cf9bd11d60ae351fbf9d5c709ada

commit 72f29e3aab56cf9bd11d60ae351fbf9d5c709ada
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Fri Dec 29 14:44:57 2017 +0100

    scandir: fix wrong assumption about errno [BZ #17804]

    malloc and realloc may set errno to ENOMEM even if they are successful.
    The scandir code wrongly assume that they do not change errno, this
    causes scandir to fail with ENOMEM even if malloc succeed.

    The code already handles that readdir might set errno by calling
    __set_errno (0) to clear the error. Move that part at the end of the
    loop to also take malloc and realloc into account.

    Changelog:
        [BZ #17804]
        * dirent/scandir-tail.c (SCANDIR_TAIL): Move __set_errno (0) at the
        end of the loop. Improve comments.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=54e4efc2876b329ba80a6965a2583a906d99e694

commit 54e4efc2876b329ba80a6965a2583a906d99e694
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Fri Dec 29 14:44:57 2017 +0100

    manual: clarify errno value on success [BZ #22615]

    The current glibc manual is ambiguous about the errno value on success
    and suggests that it is left unchanged. Some functions might and
    sometimes do change the errno value, however they never set it to 0.

    This patch from Zack Weinberg clarifies this section of the manual.

    Changelog:
        [BZ #22615]
        * manual/errno.texi (Checking for Errors): Explicitly say that errno
        might be set on success.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f8aa69be445f65bb36cb3ae9291423600da7d6d2

commit f8aa69be445f65bb36cb3ae9291423600da7d6d2
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Fri Dec 29 14:44:57 2017 +0100

    tst-realloc: do not check for errno on success [BZ #22611]

    POSIX explicitly says that applications should check errno only after
    failure, so the errno value can be clobbered on success as long as it
    is not set to zero.

    Changelog:
        [BZ #22611]
        * malloc/tst-realloc.c (do_test): Remove the test checking that errno
        is unchanged on success.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |   18 ++++++++++++++++++
 dirent/scandir-tail.c |   13 ++++++++-----
 malloc/tst-realloc.c  |    4 ----
 manual/errno.texi     |   26 +++++++++++++-------------
 4 files changed, 39 insertions(+), 22 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]