iproute2/iproute2-2.6.29-1-ss-pclose.diff
OBS User autobuild 881b4f3214 Accepting request 22166 from network:utilities
Copy from network:utilities/iproute2 based on submit request 22166 from user sax2

OBS-URL: https://build.opensuse.org/request/show/22166
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/iproute2?expand=0&rev=24
2009-10-12 12:23:19 +00:00

67 lines
1.3 KiB
Diff

--- misc/ss.c 2009-10-09 14:26:41.000000000 +0200
+++ misc/ss.c 2009-10-09 14:30:00.000000000 +0200
@@ -464,6 +464,7 @@
}
}
}
+ pclose (fp);
}
}
--- misc/ss.c 2009-10-09 14:39:14.000000000 +0200
+++ misc/ss.c 2009-10-09 14:40:25.000000000 +0200
@@ -1571,10 +1571,12 @@
status = fread(buf, 1, sizeof(*h), fp);
if (status < 0) {
perror("Reading header from $TCPDIAG_FILE");
+ fclose (fp);
return -1;
}
if (status != sizeof(*h)) {
perror("Unexpected EOF reading $TCPDIAG_FILE");
+ fclose (fp);
return -1;
}
@@ -1582,16 +1584,20 @@
if (status < 0) {
perror("Reading $TCPDIAG_FILE");
+ fclose (fp);
return -1;
}
if (status + sizeof(*h) < h->nlmsg_len) {
perror("Unexpected EOF reading $TCPDIAG_FILE");
+ fclose (fp);
return -1;
}
/* The only legal exit point */
- if (h->nlmsg_type == NLMSG_DONE)
+ if (h->nlmsg_type == NLMSG_DONE) {
+ fclose (fp);
return 0;
+ }
if (h->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
@@ -1601,13 +1607,17 @@
errno = -err->error;
perror("TCPDIAG answered");
}
+ fclose (fp);
return -1;
}
err = tcp_show_sock(h, f);
- if (err < 0)
+ if (err < 0) {
+ fclose (fp);
return err;
+ }
}
+ fclose (fp);
}
static int tcp_show(struct filter *f, int socktype)