aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.txt8
-rw-r--r--ports/unix/guts/fchmodat.c50
-rw-r--r--ports/unix/guts/fchownat.c5
-rw-r--r--pseudo.c3
4 files changed, 24 insertions, 42 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 8681eaf..9347834 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,11 @@
+2015-08-24:
+ * (seebs) drop unused/unimplemented "picky_fchmodat", since I
+ currently have no systems which implement it, and the implementation
+ for NO_REAL_AT_FUNCTIONS was difficult to define.
+ * (seebs) drop unused "doing_link" in fchownat, which I think predates
+ the current database entirely.
+ * (seebs) drop unused "old_trailing_slash".
+
2015-08-22:
* (seebs) Prevent files from getting created with real filesystem
mode 0, even with umask.
diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c
index 6ae6d2d..0506794 100644
--- a/ports/unix/guts/fchmodat.c
+++ b/ports/unix/guts/fchmodat.c
@@ -8,28 +8,17 @@
*/
PSEUDO_STATBUF buf;
int save_errno = errno;
- static int picky_fchmodat = 0;
+ if (flags & AT_SYMLINK_NOFOLLOW) {
+ errno = ENOTSUP;
+ return -1;
+ }
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
if (dirfd != AT_FDCWD) {
errno = ENOSYS;
return -1;
}
- if (flags & AT_SYMLINK_NOFOLLOW) {
- /* Linux, as of this writing, will always reject this.
- * GNU tar relies on getting the rejection. To cut down
- * on traffic, we check for the failure, and if we saw
- * a failure previously, we reject it right away and tell
- * the caller to retry.
- */
- if (picky_fchmodat) {
- errno = ENOTSUP;
- return -1;
- }
- rc = base_lstat(path, &buf);
- } else {
- rc = base_stat(path, &buf);
- }
+ rc = base_stat(path, &buf);
#else
rc = base_fstatat(dirfd, path, &buf, flags);
#endif
@@ -47,9 +36,9 @@
pseudo_msg_t *msg;
/* purely for debugging purposes: check whether file
* is already in database. We don't need the resulting
- * information for anything. This is currently ifdefed
- * out because it's only useful when trying to track where
- * files are coming from.
+ * information for anything. This is currently ifdefed
+ * out because it's only useful when trying to track where
+ * files are coming from.
*/
msg = pseudo_client_op(OP_STAT, 0, -1, -1, path, &buf);
if (!msg || msg->result != RESULT_SUCCEED) {
@@ -66,30 +55,21 @@
real_chmod(path, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode)));
#else
rc = real_fchmodat(dirfd, path, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode)), flags);
- /* AT_SYMLINK_NOFOLLOW isn't supported by fchmodat. GNU tar
- * tries to use it anyway, figuring it can just retry if that
- * fails. So we want to report that *particular* failure instead
- * of doing the fallback.
- */
- if (rc == -1 && errno == ENOTSUP && (flags & AT_SYMLINK_NOFOLLOW)) {
- picky_fchmodat = 1;
- return -1;
- }
#endif
/* we otherwise ignore failures from underlying fchmod, because pseudo
* may believe you are permitted to change modes that the filesystem
* doesn't. Note that we also don't need to know whether the
- * file might be a (pseudo) block device or some such; pseudo
- * will only modify permission bits based on an OP_CHMOD, and does
- * not care about device/file type mismatches, only directory/file
- * or symlink/file.
+ * file might be a (pseudo) block device or some such; pseudo
+ * will only modify permission bits based on an OP_CHMOD, and does
+ * not care about device/file type mismatches, only directory/file
+ * or symlink/file.
*/
buf.st_mode = (buf.st_mode & ~07777) | (mode & 07777);
pseudo_client_op(OP_CHMOD, 0, -1, dirfd, path, &buf);
- /* don't change errno from what it was originally */
- errno = save_errno;
- rc = 0;
+ /* don't change errno from what it was originally */
+ errno = save_errno;
+ rc = 0;
/* return rc;
* }
diff --git a/ports/unix/guts/fchownat.c b/ports/unix/guts/fchownat.c
index 295726b..2888087 100644
--- a/ports/unix/guts/fchownat.c
+++ b/ports/unix/guts/fchownat.c
@@ -9,7 +9,6 @@
pseudo_msg_t *msg;
PSEUDO_STATBUF buf;
int save_errno = errno;
- int doing_link = 0;
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
if (dirfd != AT_FDCWD) {
@@ -27,10 +26,6 @@
if (rc == -1) {
return rc;
}
- /* pseudo won't track the ownership, here */
- if (S_ISLNK(buf.st_mode)) {
- doing_link = 1;
- }
save_errno = errno;
if (owner == (uid_t) -1 || group == (gid_t) -1) {
diff --git a/pseudo.c b/pseudo.c
index 42aa64e..5715af2 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -497,7 +497,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
int found_path = 0, found_ino = 0;
int prefer_ino = 0;
int xattr_flags = 0;
- int trailing_slash = 0, old_trailing_slash = 0;
+ int trailing_slash = 0;
if (!msg)
return 1;
@@ -548,7 +548,6 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
if (oldpathlen > 0 && msg->op == OP_RENAME) {
if (oldpath[oldpathlen - 1] == '/') {
oldpath[--oldpathlen] = '\0';
- old_trailing_slash = 1;
}
}
/* if we got an oldpath, but a 0-length initial