• Trivial change: Remove superfluous guarding of errno around free

    From John Scott@21:1/5 to All on Sun Dec 20 14:31:47 2020
    Hi,

    I'm not subscribed; please CC me.

    It appears you don't accept Salsa merge requests or anonymous pushes, so
    I'd like to inform you of a trivial change which can be merged from my
    master branch on https://salsa.debian.org/jscott/dpkg.git
    Alternatively, the patch follows:

    No system is known to set errno when using free, successfully or
    otherwise, and POSIX Issue 8 is slated to protect it on success
    to simplify error handling:
    https://www.austingroupbugs.net/view.php?id=385
    ---
    utils/update-alternatives.c | 3 ---
    1 file changed, 3 deletions(-)

    diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
    index 89264d374..876472d47 100644
    --- a/utils/update-alternatives.c
    +++ b/utils/update-alternatives.c
    @@ -378,10 +378,7 @@ areadlink(const char *linkname)
    /* Read it and terminate the string properly */
    size = readlink(linkname, buf, st.st_size);
    if (size == -1) {
    - int saved_errno = errno;
    -
    free(buf);
    - errno = saved_errno;

    return NULL;
    }
    --
    2.29.2


    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQT287WtmxUhmhucNnhyvHFIwKstpwUCX9+mowAKCRByvHFIwKst p8yfAP9Dcf7zhtQs+K5NGr9KI31ZuoT7H1F+nzJyOXnCP6eIVQD7BZcERTZN25S4 o1MHStnR1YhSLXO2XlTJcSe6/FDSwAU=
    =qLuo
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Weimer@21:1/5 to All on Sun Dec 20 21:50:01 2020
    * John Scott:

    No system is known to set errno when using free, successfully or
    otherwise, and POSIX Issue 8 is slated to protect it on success
    to simplify error handling:
    https://www.austingroupbugs.net/view.php?id=385

    glibc currently does: <https://sourceware.org/bugzilla/show_bug.cgi?id=17924>

    We're going to fix it eventually, but current versions have this
    behavior for now.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Weimer@21:1/5 to All on Sun Dec 20 23:00:01 2020
    * John Scott:

    On Sunday, December 20, 2020 3:45:47 PM EST Florian Weimer wrote:
    glibc currently does [set errno on successful free]:
    https://sourceware.org/bugzilla/show_bug.cgi?id=17924

    Wow, I had no idea! Nevermind then, at least for now, although is it
    a coincidence that the glibc bug happened to have patches posted
    yesterday that ought to resolve it?

    I probably wouldn't have bothered to find the bug report if it had not
    had recent activity.

    Due to the GCC bug, your patch does not actually change the generated
    code, so maybe it should still be applied, even though glibc has not
    been fixed yet.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Scott@21:1/5 to All on Sun Dec 20 16:39:20 2020
    On Sunday, December 20, 2020 3:45:47 PM EST Florian Weimer wrote:
    glibc currently does [set errno on successful free]: https://sourceware.org/bugzilla/show_bug.cgi?id=17924

    Wow, I had no idea! Nevermind then, at least for now, although is it a coincidence that the glibc bug happened to have patches posted
    yesterday that ought to resolve it?

    Now that I look back I can't find references about "no known implementations" doing this, so my apologies for misleading.
    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQT287WtmxUhmhucNnhyvHFIwKstpwUCX9/EiQAKCRByvHFIwKst p1BfAQC22neYRj1ngcOSWaR4iJzn+O/ggOu0eVq73GMaVlHvSQEA+5HD0Qjd9oU+ UW4//dFUtVStBWuIRK7cMVZRENvqiQQ=
    =WO2e
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)