aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-06 01:11:19 +0100
committerDuncaen <mail@duncano.de>2017-03-06 01:11:26 +0100
commit63abed93ce294e5f9ecdc4bf4b47b36074c09b75 (patch)
tree72a12087f27d16177d07a9c38941aa7310ac0bab
parent734a95fc6b9621b0ed65979f57c2c4797eb985ba (diff)
downloadlobase-63abed93ce294e5f9ecdc4bf4b47b36074c09b75.tar.gz
bin/chmod: fix chmod and its regression tests for linux
-rw-r--r--bin/chmod/chmod.c18
-rw-r--r--regress/bin/chmod/Makefile1
2 files changed, 11 insertions, 8 deletions
diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c
index d453d00..6a668d3 100644
--- a/bin/chmod/chmod.c
+++ b/bin/chmod/chmod.c
@@ -139,7 +139,11 @@ done:
* We alter the symlink itself if doing -h or -RP, or
* if doing -RH and the symlink wasn't a command line arg.
*/
+#if !defined(__OpenBSD__)
+ atflags = 0;
+#else
atflags = AT_SYMLINK_NOFOLLOW;
+#endif
fts_options = FTS_PHYSICAL;
if (Rflag) {
@@ -154,10 +158,10 @@ done:
atflags = 0;
}
} else if (!hflag) {
+ atflags = 0;
#if !defined(__OpenBSD__)
- fts_options = FTS_LOGICAL;
+ fts_options = FTS_LOGICAL;
#endif
- atflags = 0;
}
#if 0
@@ -250,6 +254,7 @@ done:
continue;
case FTS_SL: /* Ignore. */
case FTS_SLNONE:
+#if defined(__OpenBSD__)
/*
* The only symlinks that end up here are ones that
* don't point to anything or that loop and ones
@@ -257,18 +262,16 @@ done:
*/
if (!hflag && (fts_options & FTS_LOGICAL))
continue;
-#if !defined(__OpenBSD__)
+#else
/* linux doesnt support symlink permissions */
- if (atflags) {
- warnx("skipping link");
- continue;
- }
+ continue;
#endif
break;
default:
break;
}
+#if defined(__OpenBSD__)
/*
* For -RH, the decision of how to handle symlinks depends
* on the level: follow it iff it's a command line arg.
@@ -277,6 +280,7 @@ done:
atflags = p->fts_level == FTS_ROOTLEVEL ? 0 :
AT_SYMLINK_NOFOLLOW;
}
+#endif
if (ischmod) {
if (!fchmodat(AT_FDCWD, p->fts_accpath, oct ? omode :
diff --git a/regress/bin/chmod/Makefile b/regress/bin/chmod/Makefile
index 1c3d5bb..60b9dd9 100644
--- a/regress/bin/chmod/Makefile
+++ b/regress/bin/chmod/Makefile
@@ -32,7 +32,6 @@ prepfile: clean
@mkdir -p regress
@touch regress/file
@chmod 000 regress/file
- stat -f '%p' regress/file
@[ `stat -f '%p' regress/file` == '100000' ]
chmod_prepsymlink: prepfile