Page MenuHomeFreeBSD

D13307.diff
No OneTemporary

D13307.diff

Index: head/usr.bin/xinstall/Makefile
===================================================================
--- head/usr.bin/xinstall/Makefile
+++ head/usr.bin/xinstall/Makefile
@@ -11,6 +11,7 @@
.PATH: ${SRCTOP}/contrib/mtree
CFLAGS+= -I${SRCTOP}/contrib/mtree
CFLAGS+= -I${SRCTOP}/lib/libnetbsd
+CFLAGS+= -DHAVE_STRUCT_STAT_ST_FLAGS=1
LIBADD= md
Index: head/usr.bin/xinstall/xinstall.c
===================================================================
--- head/usr.bin/xinstall/xinstall.c
+++ head/usr.bin/xinstall/xinstall.c
@@ -533,9 +533,11 @@
unlink(tmpl);
err(EX_OSERR, "%s", to_name);
}
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
~NOCHANGEBITS);
+#endif
if (verbose)
printf("install: link %s -> %s\n",
from_name, to_name);
@@ -579,9 +581,11 @@
(void)unlink(tmpl);
err(EX_OSERR, "%s", to_name);
}
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
~NOCHANGEBITS);
+#endif
if (verbose)
printf("install: symlink %s -> %s\n",
from_name, to_name);
@@ -779,9 +783,11 @@
if (target && !safecopy) {
if (to_sb.st_mode & S_IFDIR && rmdir(to_name) == -1)
err(EX_OSERR, "%s", to_name);
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name,
to_sb.st_flags & ~NOCHANGEBITS);
+#endif
unlink(to_name);
}
makelink(from_name, to_name, target ? &to_sb : NULL);
@@ -893,9 +899,11 @@
* and the files are different (or just not compared).
*/
if (tempcopy && !files_match) {
+#if HAVE_STRUCT_STAT_ST_FLAGS
/* Try to turn off the immutable bits. */
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS);
+#endif
if (dobackup) {
if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s", to_name,
suffix) != strlen(to_name) + strlen(suffix)) {
@@ -907,8 +915,10 @@
(void)printf("install: %s -> %s\n", to_name, backup);
if (unlink(backup) < 0 && errno != ENOENT) {
serrno = errno;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags);
+#endif
unlink(tempfile);
errno = serrno;
err(EX_OSERR, "unlink: %s", backup);
@@ -916,8 +926,10 @@
if (link(to_name, backup) < 0) {
serrno = errno;
unlink(tempfile);
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags);
+#endif
errno = serrno;
err(EX_OSERR, "link: %s to %s", to_name,
backup);
@@ -962,9 +974,11 @@
if (!dounpriv && ((gid != (gid_t)-1 && gid != to_sb.st_gid) ||
(uid != (uid_t)-1 && uid != to_sb.st_uid) ||
(mode != (to_sb.st_mode & ALLPERMS)))) {
+#if HAVE_STRUCT_STAT_ST_FLAGS
/* Try to turn off the immutable bits. */
if (to_sb.st_flags & NOCHANGEBITS)
(void)fchflags(to_fd, to_sb.st_flags & ~NOCHANGEBITS);
+#endif
}
if (!dounpriv &
@@ -986,7 +1000,7 @@
err(EX_OSERR, "%s: chmod", to_name);
}
}
-
+#if HAVE_STRUCT_STAT_ST_FLAGS
/*
* If provided a set of flags, set them, otherwise, preserve the
* flags, except for the dump flag.
@@ -1009,6 +1023,7 @@
}
}
}
+#endif
(void)close(to_fd);
if (!devnull)
@@ -1135,15 +1150,19 @@
* off the append/immutable bits -- if we fail, go ahead,
* it might work.
*/
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (sbp->st_flags & NOCHANGEBITS)
(void)chflags(path, sbp->st_flags & ~NOCHANGEBITS);
+#endif
if (dobackup) {
if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s",
path, suffix) != strlen(path) + strlen(suffix)) {
saved_errno = errno;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (sbp->st_flags & NOCHANGEBITS)
(void)chflags(path, sbp->st_flags);
+#endif
errno = saved_errno;
errx(EX_OSERR, "%s: backup filename too long",
path);
@@ -1155,8 +1174,10 @@
path, backup);
if (rename(path, backup) < 0) {
saved_errno = errno;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (sbp->st_flags & NOCHANGEBITS)
(void)chflags(path, sbp->st_flags);
+#endif
errno = saved_errno;
err(EX_OSERR, "rename: %s to %s", path, backup);
}
Index: head/usr.sbin/makefs/ffs.c
===================================================================
--- head/usr.sbin/makefs/ffs.c
+++ head/usr.sbin/makefs/ffs.c
@@ -70,6 +70,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
#include <sys/param.h>
#include <sys/mount.h>
@@ -315,7 +319,7 @@
ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
{
int32_t ncg = 1;
-#if notyet
+#ifdef notyet
int32_t spc, nspf, ncyl, fssize;
#endif
ffs_opt_t *ffs_opts = fsopts->fs_specific;
Index: head/usr.sbin/makefs/mtree.c
===================================================================
--- head/usr.sbin/makefs/mtree.c
+++ head/usr.sbin/makefs/mtree.c
@@ -25,6 +25,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -532,11 +536,13 @@
break;
}
flset = flclr = 0;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (!strtofflags(&value, &flset, &flclr)) {
st->st_flags &= ~flclr;
st->st_flags |= flset;
} else
error = errno;
+#endif
} else
error = ENOSYS;
break;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 1:55 AM (18 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15582037
Default Alt Text
D13307.diff (5 KB)

Event Timeline