diff -urN --exclude=.svn src/usr.bin/xinstall/xinstall.c /home/refugee/freebsd/src_cleaning/src/usr.bin/xinstall/xinstall.c --- src/usr.bin/xinstall/xinstall.c Sun Oct 31 04:42:31 2004 +++ /home/refugee/freebsd/src_cleaning/src/usr.bin/xinstall/xinstall.c Sun Dec 12 16:58:12 2004 @@ -140,9 +140,14 @@ nommap = 1; break; case 'm': - if (!(set = setmode(optarg))) - errx(EX_USAGE, "invalid file mode: %s", - optarg); + errno = 0; + if (!(set = setmode(optarg))) { + if (!errno) + errx(EX_USAGE, "invalid file mode: %s", + optarg); + else + err(EX_OSERR, "setmode"); + } mode = getmode(set, 0); free(set); break; @@ -398,8 +403,13 @@ */ if (tempcopy && !files_match) { /* Try to turn off the immutable bits. */ - if (to_sb.st_flags & NOCHANGEBITS) - (void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS); + if (to_sb.st_flags & NOCHANGEBITS) { + if (chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS) + == -1) { + unlink(tempfile); + err(EX_OSERR, "chflags"); + } + } if (dobackup) { if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s", to_name, suffix) != strlen(to_name) + strlen(suffix)) {