376 lines
9.5 KiB
Diff
376 lines
9.5 KiB
Diff
|
--- ./tc/q_netem.c.orig 2008-10-13 13:17:03.000000000 +0000
|
||
|
+++ ./tc/q_netem.c 2008-10-13 13:19:54.000000000 +0000
|
||
|
@@ -100,7 +100,8 @@
|
||
|
static int isnumber(const char *arg)
|
||
|
{
|
||
|
char *p;
|
||
|
- (void) strtod(arg, &p);
|
||
|
+ double res = 0;
|
||
|
+ res = strtod(arg, &p);
|
||
|
return (p != arg);
|
||
|
}
|
||
|
|
||
|
--- ./netem/maketable.c.orig 2008-10-13 13:32:22.000000000 +0000
|
||
|
+++ ./netem/maketable.c 2008-10-13 13:32:47.000000000 +0000
|
||
|
@@ -38,7 +38,8 @@
|
||
|
}
|
||
|
|
||
|
for (i=0; i<limit; ++i){
|
||
|
- fscanf(fp, "%lf", &x[i]);
|
||
|
+ int res = 0;
|
||
|
+ res = fscanf(fp, "%lf", &x[i]);
|
||
|
if (feof(fp))
|
||
|
break;
|
||
|
++n;
|
||
|
--- ./ip/ip6tunnel.c.orig 2008-10-13 13:09:19.000000000 +0000
|
||
|
+++ ./ip/ip6tunnel.c 2008-10-13 13:09:46.000000000 +0000
|
||
|
@@ -266,8 +266,9 @@
|
||
|
}
|
||
|
|
||
|
/* skip two lines at the begenning of the file */
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||
|
char name[IFNAMSIZ];
|
||
|
--- ./ip/ipmroute.c.orig 2008-10-13 13:11:09.000000000 +0000
|
||
|
+++ ./ip/ipmroute.c 2008-10-13 13:11:54.000000000 +0000
|
||
|
@@ -58,7 +58,8 @@
|
||
|
if (!fp)
|
||
|
return;
|
||
|
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf), fp)) {
|
||
|
int vifi;
|
||
|
@@ -83,7 +84,8 @@
|
||
|
if (!fp)
|
||
|
return;
|
||
|
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf), fp)) {
|
||
|
inet_prefix maddr, msrc;
|
||
|
--- ./ip/ipmaddr.c.orig 2008-10-13 13:10:16.000000000 +0000
|
||
|
+++ ./ip/ipmaddr.c 2008-10-13 13:10:43.000000000 +0000
|
||
|
@@ -128,7 +128,8 @@
|
||
|
if (!fp)
|
||
|
return;
|
||
|
memset(&m, 0, sizeof(m));
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
|
||
|
m.addr.family = AF_INET;
|
||
|
m.addr.bitlen = 32;
|
||
|
--- ./ip/iptunnel.c.orig 2008-10-13 13:03:20.000000000 +0000
|
||
|
+++ ./ip/iptunnel.c 2008-10-13 13:08:52.000000000 +0000
|
||
|
@@ -390,8 +390,9 @@
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||
|
char *ptr;
|
||
|
--- ./ip/rtmon.c.orig 2008-10-13 13:12:15.000000000 +0000
|
||
|
+++ ./ip/rtmon.c 2008-10-13 13:13:20.000000000 +0000
|
||
|
@@ -33,6 +33,7 @@
|
||
|
char buf[128];
|
||
|
struct nlmsghdr *n1 = (void*)buf;
|
||
|
struct timeval tv;
|
||
|
+ size_t res;
|
||
|
|
||
|
n1->nlmsg_type = 15;
|
||
|
n1->nlmsg_flags = 0;
|
||
|
@@ -42,7 +43,7 @@
|
||
|
gettimeofday(&tv, NULL);
|
||
|
((__u32*)NLMSG_DATA(n1))[0] = tv.tv_sec;
|
||
|
((__u32*)NLMSG_DATA(n1))[1] = tv.tv_usec;
|
||
|
- fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
|
||
|
+ res = fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
|
||
|
}
|
||
|
|
||
|
static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||
|
--- ./misc/lnstat_util.c.orig 2008-10-13 13:30:32.000000000 +0000
|
||
|
+++ ./misc/lnstat_util.c 2008-10-13 13:32:00.000000000 +0000
|
||
|
@@ -49,7 +49,8 @@
|
||
|
|
||
|
num_lines++;
|
||
|
|
||
|
- fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
gettimeofday(&lf->last_read, NULL);
|
||
|
|
||
|
for (j = 0; j < lf->num_fields; j++) {
|
||
|
@@ -89,12 +90,13 @@
|
||
|
for (lf = lnstat_files; lf; lf = lf->next) {
|
||
|
if (time_after(&lf->last_read, &lf->interval, &tv)) {
|
||
|
int i;
|
||
|
+ char* res = 0;
|
||
|
struct lnstat_field *lfi;
|
||
|
|
||
|
rewind(lf->fp);
|
||
|
if (!lf->compat) {
|
||
|
/* skip first line */
|
||
|
- fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
}
|
||
|
scan_lines(lf, 1);
|
||
|
|
||
|
@@ -108,7 +110,7 @@
|
||
|
}
|
||
|
|
||
|
rewind(lf->fp);
|
||
|
- fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
scan_lines(lf, 0);
|
||
|
}
|
||
|
}
|
||
|
@@ -140,9 +142,10 @@
|
||
|
static int lnstat_scan_fields(struct lnstat_file *lf)
|
||
|
{
|
||
|
char buf[FGETS_BUF_SIZE];
|
||
|
+ char* res = 0;
|
||
|
|
||
|
rewind(lf->fp);
|
||
|
- fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
+ res = fgets(buf, sizeof(buf)-1, lf->fp);
|
||
|
|
||
|
return __lnstat_scan_fields(lf, buf);
|
||
|
}
|
||
|
--- ./misc/ss.c.orig 2008-10-13 13:18:25.000000000 +0000
|
||
|
+++ ./misc/ss.c 2008-10-13 13:25:22.000000000 +0000
|
||
|
@@ -261,7 +261,8 @@
|
||
|
snprintf(tmp, sizeof(tmp), "%s/%d/stat",
|
||
|
getenv("PROC_ROOT") ? : "/proc", pid);
|
||
|
if ((fp = fopen(tmp, "r")) != NULL) {
|
||
|
- fscanf(fp, "%*d (%[^)])", process);
|
||
|
+ int res = 0;
|
||
|
+ res = fscanf(fp, "%*d (%[^)])", process);
|
||
|
fclose(fp);
|
||
|
}
|
||
|
}
|
||
|
@@ -315,7 +316,8 @@
|
||
|
|
||
|
cnt = sizeof(*s)/sizeof(int);
|
||
|
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
while(fgets(buf, sizeof(buf), fp) != NULL) {
|
||
|
int i;
|
||
|
for (i=0; i<sizeof(slabstat_ids)/sizeof(slabstat_ids[0]); i++) {
|
||
|
@@ -439,7 +441,8 @@
|
||
|
char buf[128];
|
||
|
FILE *fp = popen("/usr/sbin/rpcinfo -p 2>/dev/null", "r");
|
||
|
if (fp) {
|
||
|
- fgets(buf, sizeof(buf), fp);
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf), fp);
|
||
|
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||
|
unsigned int progn, port;
|
||
|
char proto[128], prog[128];
|
||
|
@@ -477,7 +480,8 @@
|
||
|
if (!ip_local_port_min) {
|
||
|
FILE *f = ephemeral_ports_open();
|
||
|
if (f) {
|
||
|
- fscanf(f, "%d %d",
|
||
|
+ int res = 0;
|
||
|
+ res = fscanf(f, "%d %d",
|
||
|
&ip_local_port_min, &ip_local_port_max);
|
||
|
fclose(f);
|
||
|
} else {
|
||
|
@@ -654,7 +658,8 @@
|
||
|
if (!low) {
|
||
|
FILE *fp = ephemeral_ports_open();
|
||
|
if (fp) {
|
||
|
- fscanf(fp, "%d%d", &low, &high);
|
||
|
+ int res = 0;
|
||
|
+ res = fscanf(fp, "%d%d", &low, &high);
|
||
|
fclose(fp);
|
||
|
}
|
||
|
}
|
||
|
@@ -1496,8 +1501,10 @@
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
- if (dump_fp)
|
||
|
- fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp);
|
||
|
+ if (dump_fp) {
|
||
|
+ size_t res = 0;
|
||
|
+ res = fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp);
|
||
|
+ }
|
||
|
|
||
|
h = (struct nlmsghdr*)buf;
|
||
|
while (NLMSG_OK(h, status)) {
|
||
|
@@ -1929,9 +1936,11 @@
|
||
|
int cnt;
|
||
|
struct unixstat *list = NULL;
|
||
|
|
||
|
- if ((fp = net_unix_open()) == NULL)
|
||
|
+ if ((fp = net_unix_open()) == NULL) {
|
||
|
return -1;
|
||
|
- fgets(buf, sizeof(buf)-1, fp);
|
||
|
+ }
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf)-1, fp);
|
||
|
|
||
|
if (memcmp(buf, "Peer", 4) == 0)
|
||
|
newformat = 1;
|
||
|
@@ -2017,9 +2026,11 @@
|
||
|
if (!(f->states & (1<<SS_CLOSE)))
|
||
|
return 0;
|
||
|
|
||
|
- if ((fp = net_packet_open()) == NULL)
|
||
|
+ if ((fp = net_packet_open()) == NULL) {
|
||
|
return -1;
|
||
|
- fgets(buf, sizeof(buf)-1, fp);
|
||
|
+ }
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf)-1, fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf)-1, fp)) {
|
||
|
sscanf(buf, "%llx %*d %d %x %d %d %u %u %u",
|
||
|
@@ -2090,9 +2101,11 @@
|
||
|
if (!(f->states & (1<<SS_CLOSE)))
|
||
|
return 0;
|
||
|
|
||
|
- if ((fp = net_netlink_open()) == NULL)
|
||
|
+ if ((fp = net_netlink_open()) == NULL) {
|
||
|
return -1;
|
||
|
- fgets(buf, sizeof(buf)-1, fp);
|
||
|
+ }
|
||
|
+ char* res = 0;
|
||
|
+ res = fgets(buf, sizeof(buf)-1, fp);
|
||
|
|
||
|
while (fgets(buf, sizeof(buf)-1, fp)) {
|
||
|
sscanf(buf, "%llx %d %d %x %d %d %llx %d",
|
||
|
--- ./misc/rtacct.c.orig 2008-10-13 13:28:39.000000000 +0000
|
||
|
+++ ./misc/rtacct.c 2008-10-13 13:29:37.000000000 +0000
|
||
|
@@ -526,7 +526,8 @@
|
||
|
}
|
||
|
if (fork())
|
||
|
exit(0);
|
||
|
- chdir("/");
|
||
|
+ int res = 0;
|
||
|
+ res = chdir("/");
|
||
|
close(0); close(1); close(2); setsid();
|
||
|
signal(SIGPIPE, SIG_IGN);
|
||
|
signal(SIGCHLD, sigchild);
|
||
|
@@ -562,8 +563,10 @@
|
||
|
fprintf(stderr, "rtacct: something is so wrong with history file, that I prefer not to proceed.\n");
|
||
|
exit(-1);
|
||
|
}
|
||
|
- if (stb.st_size != sizeof(*hist_db))
|
||
|
- write(fd, kern_db, sizeof(*hist_db));
|
||
|
+ if (stb.st_size != sizeof(*hist_db)) {
|
||
|
+ ssize_t res = 0;
|
||
|
+ res = write(fd, kern_db, sizeof(*hist_db));
|
||
|
+ }
|
||
|
|
||
|
hist_db = mmap(NULL, sizeof(*hist_db),
|
||
|
PROT_READ|PROT_WRITE,
|
||
|
--- ./misc/ifstat.c.orig 2008-10-13 13:27:38.000000000 +0000
|
||
|
+++ ./misc/ifstat.c 2008-10-13 13:28:22.000000000 +0000
|
||
|
@@ -665,7 +665,8 @@
|
||
|
}
|
||
|
if (fork())
|
||
|
exit(0);
|
||
|
- chdir("/");
|
||
|
+ int res = 0;
|
||
|
+ res = chdir("/");
|
||
|
close(0); close(1); close(2); setsid();
|
||
|
signal(SIGPIPE, SIG_IGN);
|
||
|
signal(SIGCHLD, sigchild);
|
||
|
@@ -717,8 +718,9 @@
|
||
|
fclose(tfp);
|
||
|
}
|
||
|
if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) {
|
||
|
+ int res = 0;
|
||
|
fprintf(stderr, "ifstat: history is aged out, resetting\n");
|
||
|
- ftruncate(fileno(hist_fp), 0);
|
||
|
+ res = ftruncate(fileno(hist_fp), 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -760,7 +762,8 @@
|
||
|
dump_incr_db(stdout);
|
||
|
}
|
||
|
if (!no_update) {
|
||
|
- ftruncate(fileno(hist_fp), 0);
|
||
|
+ int res = 0;
|
||
|
+ res = ftruncate(fileno(hist_fp), 0);
|
||
|
rewind(hist_fp);
|
||
|
dump_raw_db(hist_fp, 1);
|
||
|
fflush(hist_fp);
|
||
|
--- ./misc/nstat.c.orig 2008-10-13 13:25:58.000000000 +0000
|
||
|
+++ ./misc/nstat.c 2008-10-13 13:27:16.000000000 +0000
|
||
|
@@ -515,7 +515,8 @@
|
||
|
}
|
||
|
if (fork())
|
||
|
exit(0);
|
||
|
- chdir("/");
|
||
|
+ int res = 0;
|
||
|
+ res = chdir("/");
|
||
|
close(0); close(1); close(2); setsid();
|
||
|
signal(SIGPIPE, SIG_IGN);
|
||
|
signal(SIGCHLD, sigchild);
|
||
|
@@ -567,8 +568,9 @@
|
||
|
fclose(tfp);
|
||
|
}
|
||
|
if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) {
|
||
|
+ int res = 0;
|
||
|
fprintf(stderr, "nstat: history is aged out, resetting\n");
|
||
|
- ftruncate(fileno(hist_fp), 0);
|
||
|
+ res = ftruncate(fileno(hist_fp), 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -612,7 +614,8 @@
|
||
|
dump_incr_db(stdout);
|
||
|
}
|
||
|
if (!no_update) {
|
||
|
- ftruncate(fileno(hist_fp), 0);
|
||
|
+ int res = 0;
|
||
|
+ res = ftruncate(fileno(hist_fp), 0);
|
||
|
rewind(hist_fp);
|
||
|
dump_kern_db(hist_fp, 1);
|
||
|
fflush(hist_fp);
|
||
|
--- ./misc/arpd.c.orig 2008-10-13 13:29:59.000000000 +0000
|
||
|
+++ ./misc/arpd.c 2008-10-13 13:30:14.000000000 +0000
|
||
|
@@ -786,7 +786,8 @@
|
||
|
goto do_abort;
|
||
|
}
|
||
|
|
||
|
- chdir("/");
|
||
|
+ int res = 0;
|
||
|
+ res = chdir("/");
|
||
|
fd = open("/dev/null", O_RDWR);
|
||
|
if (fd >= 0) {
|
||
|
dup2(fd, 0);
|
||
|
--- ./ip/rtmon.c.orig 2008-10-13 15:41:51.000000000 +0200
|
||
|
+++ ./ip/rtmon.c 2008-10-13 15:42:19.000000000 +0200
|
||
|
@@ -52,7 +52,8 @@
|
||
|
FILE *fp = (FILE*)arg;
|
||
|
if (!init_phase)
|
||
|
write_stamp(fp);
|
||
|
- fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
|
||
|
+ int res = 0;
|
||
|
+ res = fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
|
||
|
fflush(fp);
|
||
|
return 0;
|
||
|
}
|