- Remove (void) casts - Bump to WARNS?= 6 Index: src/usr.sbin/mtree/create.c =================================================================== --- src/usr.sbin/mtree/create.c (revision 98) +++ src/usr.sbin/mtree/create.c (revision 99) @@ -85,12 +85,12 @@ int indent = 0; if (!nflag) { - (void)time(&cl); - (void)gethostname(host, sizeof(host)); - (void)printf( + time(&cl); + gethostname(host, sizeof(host)); + printf( "#\t user: %s\n#\tmachine: %s\n", getlogin(), host); - (void)printf( + printf( "#\t tree: %s\n#\t date: %s", fullpath, ctime(&cl)); } @@ -109,18 +109,18 @@ switch(p->fts_info) { case FTS_D: if (!dflag) - (void)printf("\n"); + printf("\n"); if (!nflag) - (void)printf("# %s\n", p->fts_path); + printf("# %s\n", p->fts_path); statd(t, p, &uid, &gid, &mode, &flags); statf(indent, p); break; case FTS_DP: if (!nflag && (p->fts_level > 0)) - (void)printf("%*s# %s\n", indent, "", p->fts_path); - (void)printf("%*s..\n", indent, ""); + printf("%*s# %s\n", indent, "", p->fts_path); + printf("%*s..\n", indent, ""); if (!dflag) - (void)printf("\n"); + printf("\n"); break; case FTS_DNR: case FTS_ERR: @@ -134,7 +134,7 @@ } } - (void)fts_close(t); + fts_close(t); if (sflag && keys & F_CKSUM) warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total); } @@ -216,7 +216,7 @@ if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 || crc(fd, &val, &len)) err(1, "%s", p->fts_accpath); - (void)close(fd); + close(fd); output(indent, &offset, "cksum=%lu", (unsigned long)val); } #ifdef MD5 @@ -257,7 +257,7 @@ output(indent, &offset, "flags=%s", fflags); free(fflags); } - (void)putchar('\n'); + putchar('\n'); } #define MAXGID 5000 @@ -342,41 +342,41 @@ (first)) { first = 0; if (dflag) - (void)printf("/set type=dir"); + printf("/set type=dir"); else - (void)printf("/set type=file"); + printf("/set type=file"); if (keys & F_UNAME) { pw = getpwuid(saveuid); if (pw != NULL) - (void)printf(" uname=%s", pw->pw_name); + printf(" uname=%s", pw->pw_name); else if (wflag) warnx( "Could not get uname for uid=%u", saveuid); else errx(1, "Could not get uname for uid=%u", saveuid); } if (keys & F_UID) - (void)printf(" uid=%lu", (u_long)saveuid); + printf(" uid=%lu", (u_long)saveuid); if (keys & F_GNAME) { gr = getgrgid(savegid); if (gr != NULL) - (void)printf(" gname=%s", gr->gr_name); + printf(" gname=%s", gr->gr_name); else if (wflag) warnx("Could not get gname for gid=%u", savegid); else errx(1, "Could not get gname for gid=%u", savegid); } if (keys & F_GID) - (void)printf(" gid=%lu", (u_long)savegid); + printf(" gid=%lu", (u_long)savegid); if (keys & F_MODE) - (void)printf(" mode=%#o", savemode); + printf(" mode=%#o", savemode); if (keys & F_NLINK) - (void)printf(" nlink=1"); + printf(" nlink=1"); if (keys & F_FLAGS) { fflags = flags_to_string(saveflags); - (void)printf(" flags=%s", fflags); + printf(" flags=%s", fflags); free(fflags); } - (void)printf("\n"); + printf("\n"); *puid = saveuid; *pgid = savegid; *pmode = savemode; @@ -404,11 +404,11 @@ va_list ap; char buf[1024]; va_start(ap, fmt); - (void)vsnprintf(buf, sizeof(buf), fmt, ap); + vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if (*offset + strlen(buf) > MAXLINELEN - 3) { - (void)printf(" \\\n%*s", INDENTNAMELEN + indent, ""); + printf(" \\\n%*s", INDENTNAMELEN + indent, ""); *offset = INDENTNAMELEN + indent; } *offset += printf(" %s", buf) + 1; Index: src/usr.sbin/mtree/verify.c =================================================================== --- src/usr.sbin/mtree/verify.c (revision 98) +++ src/usr.sbin/mtree/verify.c (revision 99) @@ -117,7 +117,7 @@ compare(ep->name, ep, p)) rval = MISMATCHEXIT; if (ep->flags & F_IGN) - (void)fts_set(t, p, FTS_SKIP); + fts_set(t, p, FTS_SKIP); else if (ep->child && ep->type == F_DIR && p->fts_info == FTS_D) { level = ep->child; @@ -130,20 +130,20 @@ continue; extra: if (!eflag) { - (void)printf("%s extra", RP(p)); + printf("%s extra", RP(p)); if (rflag) { if ((S_ISDIR(p->fts_statp->st_mode) ? rmdir : unlink)(p->fts_accpath)) { - (void)printf(", not removed: %s", + printf(", not removed: %s", strerror(errno)); } else - (void)printf(", removed"); + printf(", removed"); } - (void)putchar('\n'); + putchar('\n'); } - (void)fts_set(t, p, FTS_SKIP); + fts_set(t, p, FTS_SKIP); } - (void)fts_close(t); + fts_close(t); if (sflag) warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total); return (rval); @@ -159,7 +159,7 @@ for (; p; p = p->next) { if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) continue; - (void)strcpy(tail, p->name); + strcpy(tail, p->name); if (!(p->flags & F_VISIT)) { /* Don't print missing message if file exists as a symbolic link and the -q flag is set. */ @@ -168,7 +168,7 @@ if (qflag && stat(path, &statbuf) == 0) p->flags |= F_VISIT; else - (void)printf("%s missing", path); + printf("%s missing", path); } if (p->type != F_DIR && p->type != F_LINK) { putchar('\n'); @@ -182,31 +182,31 @@ type = "directory"; if (!(p->flags & F_VISIT) && uflag) { if (!(p->flags & (F_UID | F_UNAME))) - (void)printf(" (%s not created: user not specified)", type); + printf(" (%s not created: user not specified)", type); else if (!(p->flags & (F_GID | F_GNAME))) - (void)printf(" (%s not created: group not specified)", type); + printf(" (%s not created: group not specified)", type); else if (p->type == F_LINK) { if (symlink(p->slink, path)) - (void)printf(" (symlink not created: %s)\n", + printf(" (symlink not created: %s)\n", strerror(errno)); else - (void)printf(" (created)\n"); + printf(" (created)\n"); if (lchown(path, p->st_uid, p->st_gid)) - (void)printf("%s: user/group not modified: %s\n", + printf("%s: user/group not modified: %s\n", path, strerror(errno)); continue; } else if (!(p->flags & F_MODE)) - (void)printf(" (directory not created: mode not specified)"); + printf(" (directory not created: mode not specified)"); else if (mkdir(path, S_IRWXU)) - (void)printf(" (directory not created: %s)", + printf(" (directory not created: %s)", strerror(errno)); else { create = 1; - (void)printf(" (created)"); + printf(" (created)"); } } if (!(p->flags & F_VISIT)) - (void)putchar('\n'); + putchar('\n'); for (tp = tail; *tp; ++tp); *tp = '/'; @@ -216,18 +216,18 @@ if (!create) continue; if (chown(path, p->st_uid, p->st_gid)) { - (void)printf("%s: user/group/mode not modified: %s\n", + printf("%s: user/group/mode not modified: %s\n", path, strerror(errno)); - (void)printf("%s: warning: file mode %snot set\n", path, + printf("%s: warning: file mode %snot set\n", path, (p->flags & F_FLAGS) ? "and file flags " : ""); continue; } if (chmod(path, p->st_mode)) - (void)printf("%s: permissions not set: %s\n", + printf("%s: permissions not set: %s\n", path, strerror(errno)); if ((p->flags & F_FLAGS) && p->st_flags && chflags(path, p->st_flags)) - (void)printf("%s: file flags not set: %s\n", + printf("%s: file flags not set: %s\n", path, strerror(errno)); } } Index: src/usr.sbin/mtree/compare.c =================================================================== --- src/usr.sbin/mtree/compare.c (revision 98) +++ src/usr.sbin/mtree/compare.c (revision 99) @@ -108,7 +108,7 @@ case F_SOCK: if (!S_ISSOCK(p->fts_statp->st_mode)) { typeerr: LABEL; - (void)printf("\ttype expected %s found %s\n", + printf("\ttype expected %s found %s\n", ftype(s->type), inotype(p->fts_statp->st_mode)); return (label); } @@ -117,59 +117,59 @@ /* Set the uid/gid first, then set the mode. */ if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) { LABEL; - (void)printf("%suser expected %lu found %lu", + printf("%suser expected %lu found %lu", tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid); if (uflag) if (chown(p->fts_accpath, s->st_uid, -1)) - (void)printf(" not modified: %s\n", + printf(" not modified: %s\n", strerror(errno)); else - (void)printf(" modified\n"); + printf(" modified\n"); else - (void)printf("\n"); + printf("\n"); tab = "\t"; } if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) { LABEL; - (void)printf("%sgid expected %lu found %lu", + printf("%sgid expected %lu found %lu", tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid); if (uflag) if (chown(p->fts_accpath, -1, s->st_gid)) - (void)printf(" not modified: %s\n", + printf(" not modified: %s\n", strerror(errno)); else - (void)printf(" modified\n"); + printf(" modified\n"); else - (void)printf("\n"); + printf("\n"); tab = "\t"; } if (s->flags & F_MODE && !S_ISLNK(p->fts_statp->st_mode) && s->st_mode != (p->fts_statp->st_mode & MBITS)) { LABEL; - (void)printf("%spermissions expected %#o found %#o", + printf("%spermissions expected %#o found %#o", tab, s->st_mode, p->fts_statp->st_mode & MBITS); if (uflag) if (chmod(p->fts_accpath, s->st_mode)) - (void)printf(" not modified: %s\n", + printf(" not modified: %s\n", strerror(errno)); else - (void)printf(" modified\n"); + printf(" modified\n"); else - (void)printf("\n"); + printf("\n"); tab = "\t"; } if (s->flags & F_NLINK && s->type != F_DIR && s->st_nlink != p->fts_statp->st_nlink) { LABEL; - (void)printf("%slink_count expected %u found %u\n", + printf("%slink_count expected %u found %u\n", tab, s->st_nlink, p->fts_statp->st_nlink); tab = "\t"; } if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size && !S_ISDIR(p->fts_statp->st_mode)) { LABEL; - (void)printf("%ssize expected %jd found %jd\n", tab, + printf("%ssize expected %jd found %jd\n", tab, (intmax_t)s->st_size, (intmax_t)p->fts_statp->st_size); tab = "\t"; } @@ -181,40 +181,40 @@ ((s->st_mtimespec.tv_sec != p->fts_statp->st_mtimespec.tv_sec) || (s->st_mtimespec.tv_nsec != p->fts_statp->st_mtimespec.tv_nsec))) { LABEL; - (void)printf("%smodification time expected %.24s ", + printf("%smodification time expected %.24s ", tab, ctime(&s->st_mtimespec.tv_sec)); - (void)printf("found %.24s", + printf("found %.24s", ctime(&p->fts_statp->st_mtimespec.tv_sec)); if (uflag) { tv[0].tv_sec = s->st_mtimespec.tv_sec; tv[0].tv_usec = s->st_mtimespec.tv_nsec / 1000; tv[1] = tv[0]; if (utimes(p->fts_accpath, tv)) - (void)printf(" not modified: %s\n", + printf(" not modified: %s\n", strerror(errno)); else - (void)printf(" modified\n"); + printf(" modified\n"); } else - (void)printf("\n"); + printf("\n"); tab = "\t"; } if (s->flags & F_CKSUM) { if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0) { LABEL; - (void)printf("%scksum: %s: %s\n", + printf("%scksum: %s: %s\n", tab, p->fts_accpath, strerror(errno)); tab = "\t"; } else if (crc(fd, &val, &len)) { - (void)close(fd); + close(fd); LABEL; - (void)printf("%scksum: %s: %s\n", + printf("%scksum: %s: %s\n", tab, p->fts_accpath, strerror(errno)); tab = "\t"; } else { - (void)close(fd); + close(fd); if (s->cksum != val) { LABEL; - (void)printf("%scksum expected %lu found %lu\n", + printf("%scksum expected %lu found %lu\n", tab, s->cksum, (unsigned long)val); tab = "\t"; } @@ -223,21 +223,21 @@ if ((s->flags & F_FLAGS) && s->st_flags != p->fts_statp->st_flags) { LABEL; fflags = flags_to_string(s->st_flags); - (void)printf("%sflags expected \"%s\"", tab, fflags); + printf("%sflags expected \"%s\"", tab, fflags); free(fflags); fflags = flags_to_string(p->fts_statp->st_flags); - (void)printf(" found \"%s\"", fflags); + printf(" found \"%s\"", fflags); free(fflags); if (uflag) if (chflags(p->fts_accpath, s->st_flags)) - (void)printf(" not modified: %s\n", + printf(" not modified: %s\n", strerror(errno)); else - (void)printf(" modified\n"); + printf(" modified\n"); else - (void)printf("\n"); + printf("\n"); tab = "\t"; } #ifdef MD5 @@ -298,7 +298,7 @@ if (s->flags & F_SLINK && strcmp(cp = rlink(p->fts_accpath), s->slink)) { LABEL; - (void)printf("%slink_ref expected %s found %s\n", + printf("%slink_ref expected %s found %s\n", tab, s->slink, cp); } return (label); Index: src/usr.sbin/mtree/spec.c =================================================================== --- src/usr.sbin/mtree/spec.c (revision 98) +++ src/usr.sbin/mtree/spec.c (revision 99) @@ -93,7 +93,7 @@ continue; #ifdef DEBUG - (void)fprintf(stderr, "line %d: {%s}\n", lineno, p); + fprintf(stderr, "line %d: {%s}\n", lineno, p); #endif if (c_cur) { set(p, centry); Index: src/usr.sbin/mtree/Makefile =================================================================== --- src/usr.sbin/mtree/Makefile (revision 98) +++ src/usr.sbin/mtree/Makefile (revision 99) @@ -8,7 +8,7 @@ SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c SRCS+= specspec.c -WARNS?= 4 +WARNS?= 6 CFLAGS+= -DMD5 -DSHA1 -DRMD160 DPADD= ${LIBMD} Index: src/usr.sbin/mtree/mtree.c =================================================================== --- src/usr.sbin/mtree/mtree.c (revision 98) +++ src/usr.sbin/mtree/mtree.c (revision 99) @@ -183,7 +183,7 @@ static void usage(void) { - (void)fprintf(stderr, + fprintf(stderr, "usage: mtree [-LPUcdeinqruxw] [-f spec] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n" "\t[-X excludes]\n"); exit(1);