summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-24 22:38:07 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-24 22:38:07 +0000
commit514b01809712a80b8c2323f016ac9b9282754740 (patch)
tree62aa90916c7df9e6394e7b5c32a5ee694dd9d6a5
parent113038fe9363123323fb3bcccbf6d2f86881427a (diff)
Try to preserve file flags in mv (Kamo Hiroyasu <wd@ics.nara-wu.ac.jp>)
-rw-r--r--bin/mv/mv.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 2ef0350e470..5d9acdf53c4 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mv.c,v 1.14 1999/07/26 21:29:45 aaron Exp $ */
+/* $OpenBSD: mv.c,v 1.15 1999/12/24 22:38:06 angelos Exp $ */
/* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: mv.c,v 1.14 1999/07/26 21:29:45 aaron Exp $";
+static char rcsid[] = "$OpenBSD: mv.c,v 1.15 1999/12/24 22:38:06 angelos Exp $";
#endif
#endif /* not lint */
@@ -325,6 +325,18 @@ err: if (unlink(to))
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode", to);
+ /*
+ * XXX
+ * NFS doesn't support chflags; ignore errors unless there's reason
+ * to believe we're losing bits. (Note, this still won't be right
+ * if the server supports flags and we were trying to *remove* flags
+ * on a file that we copied, i.e., that we didn't create.)
+ */
+ errno = 0;
+ if (fchflags(to_fd, sbp->st_flags))
+ if (errno != EOPNOTSUPP || sbp->st_flags != 0)
+ warn("%s: set flags", to);
+
tval[0].tv_sec = sbp->st_atime;
tval[1].tv_sec = sbp->st_mtime;
tval[0].tv_usec = tval[1].tv_usec = 0;