Date: Sun, 9 Dec 2001 22:01:12 +0100 From: Maxime Henrion <mux@qualys.com> To: freebsd-audit@FreeBSD.org Subject: More WARNS?=2 cleanup for /usr/src/usr.sbin/ Message-ID: <20011209220112.B298@nebula.noos.fr>
next in thread | raw e-mail | index | archive | help
--+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, Here is another set of patches to set WARNS to 2 for some programs in /usr/src/usr.sbin/. These programs are arp(8), boot0cfg(8), chroot(8), digictl(8), edquota(8) and repquota(8). I think it's worth explaining some of them : o arp(8) : there was some warnings for missing initializers for these kind of declaration : struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}}; this is because the ``char sin_zero[8];'' field is not initialized and rather than doing : struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}, "\0\0\0\0\0\0\0"}; (I couldn't find something more correct) I moved these (global) declarations to the top of the file and initialized the structures in the main() function. o boot0cfg(8) : there was a warning in the mkrdev() function because of a const qualifier discarded by an assignment. The function was sometimes returning an strdup()'d pointer, and sometimes returning the original pointer passed as an argument. I solved this by always doing a strdup(), which is IMHO more correct, and allows us to safely free() it after (it wasn't free()'d previously). o digictl(8) : I just had to add the WARNS option to the Makefile for this one :-) Thanks, Maxime Henrion -- Don't be fooled by cheap finnish imitations ; BSD is the One True Code --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="warns.diff" Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/arp/Makefile,v retrieving revision 1.6 diff -u -r1.6 Makefile --- Makefile 20 Jul 2001 04:22:58 -0000 1.6 +++ Makefile 7 Dec 2001 00:35:43 -0000 @@ -4,4 +4,6 @@ PROG= arp MAN= arp.4 arp.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: arp.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/arp/arp.c,v retrieving revision 1.33 diff -u -r1.33 arp.c --- arp.c 19 Oct 2001 00:33:26 -0000 1.33 +++ arp.c 9 Dec 2001 17:25:45 -0000 @@ -84,9 +84,9 @@ void search(u_long addr, void (*action)(struct sockaddr_dl *sdl, struct sockaddr_inarp *sin, struct rt_msghdr *rtm)); void print_entry(struct sockaddr_dl *sdl, - struct sockaddr_inarp *sin, struct rt_msghdr *rtm); + struct sockaddr_inarp *addr, struct rt_msghdr *rtm); void nuke_entry(struct sockaddr_dl *sdl, - struct sockaddr_inarp *sin, struct rt_msghdr *rtm); + struct sockaddr_inarp *addr, struct rt_msghdr *rtm); int delete(char *host, char *info); void ether_print(u_char *cp); void usage(void); @@ -103,6 +103,15 @@ static int aflag; /* do it for all entries */ static int s = -1; +struct sockaddr_in so_mask; +struct sockaddr_inarp blank_sin, sin_m; +struct sockaddr_dl blank_sdl, sdl_m; +int expire_time, flags, doing_proxy, proxy_only, found_entry; +struct { + struct rt_msghdr m_rtm; + char m_space[512]; +} m_rtmsg; + /* which function we're supposed to do */ #define F_GET 1 #define F_SET 2 @@ -148,6 +157,16 @@ argc -= optind; argv += optind; + memset(&so_mask, 0, sizeof (so_mask)); + so_mask.sin_family = 8; + so_mask.sin_addr.s_addr = 0xffffffff; + memset(&blank_sin, 0, sizeof (blank_sin)); + blank_sin.sin_len = sizeof (blank_sin); + blank_sin.sin_family = AF_INET; + memset(&blank_sdl, 0, sizeof (blank_sdl)); + blank_sdl.sdl_len = sizeof (blank_sdl); + blank_sdl.sdl_family = AF_LINK; + if (!func) func = F_GET; switch (func) { @@ -234,15 +253,6 @@ } } -struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}}; -struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; -struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m; -int expire_time, flags, doing_proxy, proxy_only, found_entry; -struct { - struct rt_msghdr m_rtm; - char m_space[512]; -} m_rtmsg; - /* * Set an individual arp entry */ @@ -250,7 +260,7 @@ set(int argc, char **argv) { struct hostent *hp; - register struct sockaddr_inarp *sin = &sin_m; + register struct sockaddr_inarp *addr = &sin_m; register struct sockaddr_dl *sdl; register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); u_char *ea; @@ -261,14 +271,14 @@ argv += 2; sdl_m = blank_sdl; sin_m = blank_sin; - sin->sin_addr.s_addr = inet_addr(host); - if (sin->sin_addr.s_addr == INADDR_NONE) { + addr->sin_addr.s_addr = inet_addr(host); + if (addr->sin_addr.s_addr == INADDR_NONE) { if (!(hp = gethostbyname(host))) { warnx("%s: %s", host, hstrerror(h_errno)); return (1); } - bcopy((char *)hp->h_addr, (char *)&sin->sin_addr, - sizeof sin->sin_addr); + bcopy((char *)hp->h_addr, (char *)&addr->sin_addr, + sizeof addr->sin_addr); } doing_proxy = flags = proxy_only = expire_time = 0; while (argc-- > 0) { @@ -293,9 +303,9 @@ } ea = (u_char *)LLADDR(&sdl_m); if (doing_proxy && !strcmp(eaddr, "auto")) { - if (!get_ether_addr(sin->sin_addr.s_addr, ea)) { + if (!get_ether_addr(addr->sin_addr.s_addr, ea)) { printf("no interface found for %s\n", - inet_ntoa(sin->sin_addr)); + inet_ntoa(addr->sin_addr)); return (1); } sdl_m.sdl_alen = 6; @@ -308,9 +318,9 @@ warn("%s", host); return (1); } - sin = (struct sockaddr_inarp *)(rtm + 1); - sdl = (struct sockaddr_dl *)(ROUNDUP(sin->sin_len) + (char *)sin); - if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { + addr = (struct sockaddr_inarp *)(rtm + 1); + sdl = (struct sockaddr_dl *)(ROUNDUP(addr->sin_len) + (char *)addr); + if (addr->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && (rtm->rtm_flags & RTF_LLINFO) && !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { @@ -347,20 +357,20 @@ get(char *host) { struct hostent *hp; - struct sockaddr_inarp *sin = &sin_m; + struct sockaddr_inarp *addr = &sin_m; sin_m = blank_sin; - sin->sin_addr.s_addr = inet_addr(host); - if (sin->sin_addr.s_addr == INADDR_NONE) { + addr->sin_addr.s_addr = inet_addr(host); + if (addr->sin_addr.s_addr == INADDR_NONE) { if (!(hp = gethostbyname(host))) errx(1, "%s: %s", host, hstrerror(h_errno)); - bcopy((char *)hp->h_addr, (char *)&sin->sin_addr, - sizeof sin->sin_addr); + bcopy((char *)hp->h_addr, (char *)&addr->sin_addr, + sizeof addr->sin_addr); } - search(sin->sin_addr.s_addr, print_entry); + search(addr->sin_addr.s_addr, print_entry); if (found_entry == 0) { printf("%s (%s) -- no entry\n", - host, inet_ntoa(sin->sin_addr)); + host, inet_ntoa(addr->sin_addr)); return(1); } return(0); @@ -373,7 +383,7 @@ delete(char *host, char *info) { struct hostent *hp; - register struct sockaddr_inarp *sin = &sin_m; + register struct sockaddr_inarp *addr = &sin_m; register struct rt_msghdr *rtm = &m_rtmsg.m_rtm; struct sockaddr_dl *sdl; @@ -385,23 +395,23 @@ else usage(); } - sin->sin_addr.s_addr = inet_addr(host); - if (sin->sin_addr.s_addr == INADDR_NONE) { + addr->sin_addr.s_addr = inet_addr(host); + if (addr->sin_addr.s_addr == INADDR_NONE) { if (!(hp = gethostbyname(host))) { warnx("%s: %s", host, hstrerror(h_errno)); return (1); } - bcopy((char *)hp->h_addr, (char *)&sin->sin_addr, - sizeof sin->sin_addr); + bcopy((char *)hp->h_addr, (char *)&addr->sin_addr, + sizeof addr->sin_addr); } tryagain: if (rtmsg(RTM_GET) < 0) { warn("%s", host); return (1); } - sin = (struct sockaddr_inarp *)(rtm + 1); - sdl = (struct sockaddr_dl *)(ROUNDUP(sin->sin_len) + (char *)sin); - if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { + addr = (struct sockaddr_inarp *)(rtm + 1); + sdl = (struct sockaddr_dl *)(ROUNDUP(addr->sin_len) + (char *)addr); + if (addr->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && (rtm->rtm_flags & RTF_LLINFO) && !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { @@ -423,7 +433,7 @@ return (1); } if (rtmsg(RTM_DELETE) == 0) { - printf("%s (%s) deleted\n", host, inet_ntoa(sin->sin_addr)); + printf("%s (%s) deleted\n", host, inet_ntoa(addr->sin_addr)); return (0); } return (1); @@ -440,7 +450,7 @@ size_t needed; char *lim, *buf, *next; struct rt_msghdr *rtm; - struct sockaddr_inarp *sin; + struct sockaddr_inarp *sin2; struct sockaddr_dl *sdl; mib[0] = CTL_NET; @@ -458,14 +468,14 @@ lim = buf + needed; for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; - sin = (struct sockaddr_inarp *)(rtm + 1); - (char *)sdl = (char *)sin + ROUNDUP(sin->sin_len); + sin2 = (struct sockaddr_inarp *)(rtm + 1); + (char *)sdl = (char *)sin2 + ROUNDUP(sin2->sin_len); if (addr) { - if (addr != sin->sin_addr.s_addr) + if (addr != sin2->sin_addr.s_addr) continue; found_entry = 1; } - (*action)(sdl, sin, rtm); + (*action)(sdl, sin2, rtm); } free(buf); } @@ -475,7 +485,7 @@ */ void print_entry(struct sockaddr_dl *sdl, - struct sockaddr_inarp *sin, struct rt_msghdr *rtm) + struct sockaddr_inarp *addr, struct rt_msghdr *rtm) { const char *host; struct hostent *hp; @@ -483,8 +493,8 @@ int seg; if (nflag == 0) - hp = gethostbyaddr((caddr_t)&(sin->sin_addr), - sizeof sin->sin_addr, AF_INET); + hp = gethostbyaddr((caddr_t)&(addr->sin_addr), + sizeof addr->sin_addr, AF_INET); else hp = 0; if (hp) @@ -494,7 +504,7 @@ if (h_errno == TRY_AGAIN) nflag = 1; } - printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr)); + printf("%s (%s) at ", host, inet_ntoa(addr->sin_addr)); if (sdl->sdl_alen) ether_print(LLADDR(sdl)); else @@ -503,14 +513,14 @@ printf(" on %s", ifname); if (rtm->rtm_rmx.rmx_expire == 0) printf(" permanent"); - if (sin->sin_other & SIN_PROXY) + if (addr->sin_other & SIN_PROXY) printf(" published (proxy only)"); if (rtm->rtm_addrs & RTA_NETMASK) { - sin = (struct sockaddr_inarp *) + addr = (struct sockaddr_inarp *) (ROUNDUP(sdl->sdl_len) + (char *)sdl); - if (sin->sin_addr.s_addr == 0xffffffff) + if (addr->sin_addr.s_addr == 0xffffffff) printf(" published"); - if (sin->sin_len != 8) + if (addr->sin_len != 8) printf("(weird)"); } switch(sdl->sdl_type) { @@ -545,12 +555,12 @@ * Nuke an arp entry */ void -nuke_entry(struct sockaddr_dl *sdl, - struct sockaddr_inarp *sin, struct rt_msghdr *rtm) +nuke_entry(struct sockaddr_dl *sdl __unused, + struct sockaddr_inarp *addr, struct rt_msghdr *rtm __unused) { char ip[20]; - snprintf(ip, sizeof(ip), "%s", inet_ntoa(sin->sin_addr)); + snprintf(ip, sizeof(ip), "%s", inet_ntoa(addr->sin_addr)); delete(ip, NULL); } @@ -670,17 +680,17 @@ struct ifreq ifreq; struct ifconf ifc; struct ifreq ifs[MAX_IFS]; - int s; + int sock; - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) err(1, "socket"); ifc.ifc_len = sizeof(ifs); ifc.ifc_req = ifs; if (ioctl(s, SIOCGIFCONF, &ifc) < 0) { warnx("ioctl(SIOCGIFCONF)"); - close(s); + close(sock); return 0; } @@ -724,7 +734,7 @@ } if (ifr >= ifend) { - close(s); + close(sock); return 0; } Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/boot0cfg/Makefile,v retrieving revision 1.6 diff -u -r1.6 Makefile --- Makefile 21 Jul 2001 14:32:45 -0000 1.6 +++ Makefile 9 Dec 2001 17:31:17 -0000 @@ -3,4 +3,6 @@ PROG= boot0cfg MAN= boot0cfg.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: boot0cfg.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/boot0cfg/boot0cfg.c,v retrieving revision 1.11 diff -u -r1.11 boot0cfg.c --- boot0cfg.c 22 Mar 2001 22:55:13 -0000 1.11 +++ boot0cfg.c 9 Dec 2001 17:39:56 -0000 @@ -92,7 +92,8 @@ { u_int8_t *mbr, *boot0; int boot0_size, mbr_size; - const char *bpath, *fpath, *disk; + const char *bpath, *fpath; + char *disk; int B_flag, v_flag, o_flag; int d_arg, m_arg, s_arg, t_arg; int o_and, o_or; @@ -201,6 +202,7 @@ if (mbr != boot0) free(boot0); free(mbr); + free(disk); return 0; } @@ -316,7 +318,7 @@ return 0x100; /* We have a newer boot0, so extract the version number and return it. */ - return *(int *)(bs + OFF_VERSION) & 0xffff; + return *(const int *)(bs + OFF_VERSION) & 0xffff; } /* @@ -337,7 +339,7 @@ {0x0, sizeof(id0), id0}, {0x1b2, sizeof(id1), id1} }; - int i; + unsigned int i; for (i = 0; i < sizeof(ident) / sizeof(ident[0]); i++) if (memcmp(bs + ident[i].off, ident[i].key, ident[i].len)) @@ -385,12 +387,14 @@ char buf[MAXPATHLEN]; char *s; - s = (char *)fname; if (!strchr(fname, '/')) { snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname); - if (!(s = strdup(buf))) - err(1, NULL); - } + s = strdup(buf); + } else + s = strdup(fname); + + if (s == NULL) + errx(1, "No more memory"); return s; } Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/chroot/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- Makefile 26 Mar 2001 14:39:41 -0000 1.4 +++ Makefile 9 Dec 2001 16:59:49 -0000 @@ -4,4 +4,6 @@ PROG= chroot MAN= chroot.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: chroot.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/chroot/chroot.c,v retrieving revision 1.5 diff -u -r1.5 chroot.c --- chroot.c 9 Jul 2001 09:23:57 -0000 1.5 +++ chroot.c 9 Dec 2001 17:01:00 -0000 @@ -62,7 +62,7 @@ char *argv[]; { int ch; - char *shell; + const char *shell; while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/digictl/Makefile,v retrieving revision 1.3 diff -u -r1.3 Makefile --- Makefile 17 May 2001 01:42:52 -0000 1.3 +++ Makefile 9 Dec 2001 17:44:09 -0000 @@ -3,4 +3,6 @@ PROG= digictl MAN= digictl.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/edquota/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- Makefile 26 Mar 2001 14:39:56 -0000 1.4 +++ Makefile 9 Dec 2001 17:46:37 -0000 @@ -4,4 +4,6 @@ PROG= edquota MAN= edquota.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: edquota.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/edquota/edquota.c,v retrieving revision 1.13 diff -u -r1.13 edquota.c --- edquota.c 28 Sep 2001 10:22:36 -0000 1.13 +++ edquota.c 9 Dec 2001 17:54:05 -0000 @@ -69,9 +69,9 @@ #include <unistd.h> #include "pathnames.h" -char *qfname = QUOTAFILENAME; -char *qfextension[] = INITQFNAMES; -char *quotagroup = QUOTAGROUP; +const char *qfname = QUOTAFILENAME; +const char *qfextension[] = INITQFNAMES; +const char *quotagroup = QUOTAGROUP; char tmpfil[] = _PATH_TMP; struct quotause { @@ -83,12 +83,12 @@ }; #define FOUND 0x01 -int alldigits __P((char *s)); +int alldigits __P((const char *s)); int cvtatos __P((time_t, char *, time_t *)); char *cvtstoa __P((time_t)); int editit __P((char *)); void freeprivs __P((struct quotause *)); -int getentry __P((char *, int)); +int getentry __P((const char *, int)); struct quotause *getprivs __P((long, int, char *)); int hasquota __P((struct fstab *, int, char **)); void putprivs __P((long, int, struct quotause *)); @@ -220,7 +220,7 @@ */ int getentry(name, quotatype) - char *name; + const char *name; int quotatype; { struct passwd *pw; @@ -364,11 +364,11 @@ * Take a list of priviledges and get it edited. */ int -editit(tmpfile) - char *tmpfile; +editit(tmpf) + char *tmpf; { long omask; - int pid, stat; + int pid, status; omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); top: @@ -386,19 +386,19 @@ return (0); } if (pid == 0) { - register char *ed; + register const char *ed; sigsetmask(omask); setgid(getgid()); setuid(getuid()); if ((ed = getenv("EDITOR")) == (char *)0) ed = _PATH_VI; - execlp(ed, ed, tmpfile, (char *)0); + execlp(ed, ed, tmpf, (char *)0); err(1, "%s", ed); } - waitpid(pid, &stat, 0); + waitpid(pid, &status, 0); sigsetmask(omask); - if (!WIFEXITED(stat) || WEXITSTATUS(stat) != 0) + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return (0); return (1); } @@ -653,22 +653,22 @@ * Convert seconds to ASCII times. */ char * -cvtstoa(time) - time_t time; +cvtstoa(secs) + time_t secs; { static char buf[20]; - if (time % (24 * 60 * 60) == 0) { - time /= 24 * 60 * 60; - sprintf(buf, "%ld day%s", (long)time, time == 1 ? "" : "s"); - } else if (time % (60 * 60) == 0) { - time /= 60 * 60; - sprintf(buf, "%ld hour%s", (long)time, time == 1 ? "" : "s"); - } else if (time % 60 == 0) { - time /= 60; - sprintf(buf, "%ld minute%s", (long)time, time == 1 ? "" : "s"); + if (secs % (24 * 60 * 60) == 0) { + secs /= 24 * 60 * 60; + sprintf(buf, "%ld day%s", (long)secs, secs == 1 ? "" : "s"); + } else if (secs % (60 * 60) == 0) { + secs /= 60 * 60; + sprintf(buf, "%ld hour%s", (long)secs, secs == 1 ? "" : "s"); + } else if (secs % 60 == 0) { + secs /= 60; + sprintf(buf, "%ld minute%s", (long)secs, secs == 1 ? "" : "s"); } else - sprintf(buf, "%ld second%s", (long)time, time == 1 ? "" : "s"); + sprintf(buf, "%ld second%s", (long)secs, secs == 1 ? "" : "s"); return (buf); } @@ -676,20 +676,20 @@ * Convert ASCII input times to seconds. */ int -cvtatos(time, units, seconds) - time_t time; +cvtatos(tim, units, seconds) + time_t tim; char *units; time_t *seconds; { if (bcmp(units, "second", 6) == 0) - *seconds = time; + *seconds = tim; else if (bcmp(units, "minute", 6) == 0) - *seconds = time * 60; + *seconds = tim * 60; else if (bcmp(units, "hour", 4) == 0) - *seconds = time * 60 * 60; + *seconds = tim * 60 * 60; else if (bcmp(units, "day", 3) == 0) - *seconds = time * 24 * 60 * 60; + *seconds = tim * 24 * 60 * 60; else { printf("%s: bad units, specify %s\n", units, "days, hours, minutes, or seconds"); @@ -718,9 +718,9 @@ */ int alldigits(s) - register char *s; + register const char *s; { - register c; + register int c; c = *s++; do { Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/repquota/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- Makefile 26 Mar 2001 14:41:39 -0000 1.4 +++ Makefile 9 Dec 2001 17:57:43 -0000 @@ -4,4 +4,6 @@ PROG= repquota MAN= repquota.8 +WARNS?= 2 + .include <bsd.prog.mk> Index: repquota.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/repquota/repquota.c,v retrieving revision 1.10 diff -u -r1.10 repquota.c --- repquota.c 19 Jun 2001 00:47:24 -0000 1.10 +++ repquota.c 9 Dec 2001 18:06:39 -0000 @@ -78,8 +78,8 @@ #define max(a,b) ((a) >= (b) ? (a) : (b)) -char *qfname = QUOTAFILENAME; -char *qfextension[] = INITQFNAMES; +const char *qfname = QUOTAFILENAME; +const char *qfextension[] = INITQFNAMES; struct fileusage { struct fileusage *fu_next; @@ -90,8 +90,8 @@ }; #define FUHASH 1024 /* must be power of two */ struct fileusage *fuhead[MAXQUOTAS][FUHASH]; -struct fileusage *lookup(); -struct fileusage *addid(); +struct fileusage *lookup(u_long, int); +struct fileusage *addid(u_long, int, char *); u_long highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */ int vflag; /* verbose */ @@ -257,9 +257,9 @@ fup->fu_dqblk.dqb_bsoftlimit ? timeprt(fup->fu_dqblk.dqb_btime) : "-"); printf(" %7lu %7lu %7lu %6s\n", - fup->fu_dqblk.dqb_curinodes, - fup->fu_dqblk.dqb_isoftlimit, - fup->fu_dqblk.dqb_ihardlimit, + (unsigned long)fup->fu_dqblk.dqb_curinodes, + (unsigned long)fup->fu_dqblk.dqb_isoftlimit, + (unsigned long)fup->fu_dqblk.dqb_ihardlimit, fup->fu_dqblk.dqb_isoftlimit && fup->fu_dqblk.dqb_curinodes >= fup->fu_dqblk.dqb_isoftlimit ? @@ -389,19 +389,22 @@ if (now == 0) time(&now); - if (now > seconds) - return ("none"); + if (now > seconds) { + strlcpy(buf, "none", sizeof (buf)); + return (buf); + } seconds -= now; minutes = (seconds + 30) / 60; hours = (minutes + 30) / 60; if (hours >= 36) { - sprintf(buf, "%lddays", (hours + 12) / 24); + sprintf(buf, "%lddays", (long)(hours + 12) / 24); return (buf); } if (minutes >= 60) { - sprintf(buf, "%2ld:%ld", minutes / 60, minutes % 60); + sprintf(buf, "%2ld:%ld", (long)minutes / 60, + (long)minutes % 60); return (buf); } - sprintf(buf, "%2ld", minutes); + sprintf(buf, "%2ld", (long)minutes); return (buf); } --+HP7ph2BbKc20aGI-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011209220112.B298>