summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-05-03 12:20:00 +0200
committerAndreas Gruenbacher <agruen@suse.de>2010-05-03 12:20:00 +0200
commit76aa1070c87e463ae4ea781dd5e0b1709c577d04 (patch)
tree9f1fc91c52d3d5e1b6a5204985a6ec4f28039ef0
parent0e952c6d344223b3bdd988f1978137fbcc450ef6 (diff)
downloadpatch-76aa1070c87e463ae4ea781dd5e0b1709c577d04.tar.gz
Do not try to set file permissions of symlinks
* src/pch.c (fetchmode): Document that the "diff --git" format does not store file permissions of symlinks. * src/util.c (set_file_attributes): Since we don't have symlink file permissions, don't try to set them even on systems where we could.
-rw-r--r--ChangeLog5
-rw-r--r--src/pch.c4
-rw-r--r--src/util.c5
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 44cec25..7df3427 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-05-02 Andreas Gruenbacher <agruen@suse.de>
+ * src/pch.c (fetchmode): Document that the "diff --git" format does
+ not store file permissions of symlinks.
+ * src/util.c (set_file_attributes): Since we don't have symlink file
+ permissions, don't try to set them even on systems where we could.
+
* tests/symlinks: Improve the backup file tests.
2009-05-02 Andreas Gruenbacher <agruen@suse.de>
diff --git a/src/pch.c b/src/pch.c
index 5d8a6f5..db50892 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -335,6 +335,10 @@ fetchmode (char const *str)
if (*s != '\n')
mode = 0;
+ /* NOTE: The "diff --git" format always sets the file mode permission
+ bits of symlinks to 0. (On Linux, symlinks actually always have
+ 0777 permissions, so this is not even consistent.) */
+
return mode;
}
diff --git a/src/util.c b/src/util.c
index d83b3ff..cf58983 100644
--- a/src/util.c
+++ b/src/util.c
@@ -173,7 +173,10 @@ set_file_attributes (char const *to, enum file_attributes attr,
{
if (! mode)
mode = st->st_mode;
-#ifdef HAVE_LCHMOD
+#if 0 && defined HAVE_LCHMOD
+ /* The "diff --git" format does not store the file permissions of
+ symlinks, so don't try to set symlink file permissions even on
+ systems where we could. */
if (lchmod (to, mode))
#else
if (! S_ISLNK (mode) && chmod (to, mode) != 0)