[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: areadlinkat
From: |
Eric Blake |
Subject: |
Re: areadlinkat |
Date: |
Mon, 26 Oct 2009 21:43:57 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 10/21/2009 9:33 PM:
>> + * lib/at-func.c (FUNC_FAIL): New define.
>> + (AT_FUNC_NAME, VALIDATE_FLAG): Use it rather than raw -1.
>
> Oops - I missed one instance relating to FUNC_FAIL. test-areadlinkat was
> failing on older Linux, because /proc/self/fd/-1/name gave ENOENT rather
> than EBADF. But since 0 <= char* was always true, the fallback code that
> converts ENOENT into the correct error was never triggered.
> areadlinkat-with-size was the only other impacted client of at-func.c.
And yet one more instance, this time caught by gcc warnings, but harder to
trigger in code.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrmbH0ACgkQ84KuGfSFAYDpWQCgrWMK8ir72haggTGduiJGqC72
d9gAn2RURQebGVmyTCQW4j+HgypDwVrD
=uVhI
-----END PGP SIGNATURE-----
>From 185233aa304e916609398bc9539029c01805b4d6 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 26 Oct 2009 21:41:21 -0600
Subject: [PATCH] areadlinkat: fix fallback path
* lib/at-func.c (AT_FUNC_NAME): Avoid signed comparison between
pointer and zero.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
lib/at-func.c | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e2f8551..0897109 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-26 Eric Blake <address@hidden>
+
+ areadlinkat: fix fallback path
+ * lib/at-func.c (AT_FUNC_NAME): Avoid signed comparison between
+ pointer and zero.
+
2009-10-22 Pádraig Brady <address@hidden>
Use a better IO block size for modern systems
diff --git a/lib/at-func.c b/lib/at-func.c
index cc7bfc2..73be401 100644
--- a/lib/at-func.c
+++ b/lib/at-func.c
@@ -115,7 +115,7 @@ AT_FUNC_NAME (int fd, char const *file
AT_FUNC_POST_FILE_PARAM_DECLS)
}
err = CALL_FUNC (file);
- saved_errno = (err < 0 ? errno : 0);
+ saved_errno = (err == FUNC_FAIL ? errno : 0);
if (restore_cwd (&saved_cwd) != 0)
openat_restore_fail (errno);
--
1.6.5.rc1
Message not available
Message not available