[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: link
From: |
Eric Blake |
Subject: |
Re: link |
Date: |
Wed, 23 Sep 2009 06:22:04 -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 9/19/2009 8:28 PM:
> According to Eric Blake on 9/9/2009 5:31 PM:
>> Meanwhile, I noticed that the link module has a bug on mingw, where link
>> ("a","b/.") created the regular file "b" rather than failing with ENOENT (I
>> noticed it because cygwin 1.5 had the same bug, and I noticed that while
>> enhancing the link module to work around Solaris 8 handling of trailing / in
>> link).
Further testing reveals that I fixed link("file","oops/"), but that
link("file/","oops") is still broken on Solaris 9 until this patch, now
pushed:
- --
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/
iEYEARECAAYFAkq6EusACgkQ84KuGfSFAYAYCACg1KuN66eYg+w/ntwJku70uqfH
zVEAni7SbFfH2XTMByaIWgQ7kb1+bHbU
=nMsM
-----END PGP SIGNATURE-----
>From e2ff69eccc2f656e305cfd81c6e0d9fa2dffc3eb Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 23 Sep 2009 06:10:36 -0600
Subject: [PATCH] link: fix test failure on Solaris 9
* lib/link.c (rpl_link): Don't assume link will catch bogus
trailing slash on source.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
lib/link.c | 10 ++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 65a09a1..290e575 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-23 Eric Blake <address@hidden>
+
+ link: fix test failure on Solaris 9
+ * lib/link.c (rpl_link): Don't assume link will catch bogus
+ trailing slash on source.
+
2009-09-09 Eric Blake <address@hidden>
renameat: new module
diff --git a/lib/link.c b/lib/link.c
index 72b8600..42d086c 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -162,11 +162,13 @@ rpl_link (char const *file1, char const *file2)
|| (len2 && file2[len2 - 1] == '/'))
{
/* Let link() decide whether hard-linking directories is legal.
- If stat() fails, link() will probably fail for the same
- reason; so we only have to worry about successful stat() and
- non-directory. */
+ If stat() fails, then link() should fail for the same reason
+ (although on Solaris 9, link("file/","oops") mistakenly
+ succeeds); if stat() succeeds, require a directory. */
struct stat st;
- if (stat (file1, &st) == 0 && !S_ISDIR (st.st_mode))
+ if (stat (file1, &st))
+ return -1;
+ if (!S_ISDIR (st.st_mode))
{
errno = ENOTDIR;
return -1;
--
1.6.5.rc1