7 /* this will be running setgid root, so be careful! */
10 fprintf(stderr, "usage: netreport [-r]\n");
16 int main(int argc, char ** argv) {
18 /* more than long enough for "/var/run/netreport/<pid>\0" */
19 char netreport_name[64];
22 if (argc > 2) usage();
24 if ((argc > 1) && !strcmp(argv[1], "-r")) {
28 sprintf(netreport_name, "/var/run/netreport/%d", getppid());
30 netreport_file = creat(netreport_name, 0);
31 if (netreport_file < 0) {
32 if (errno != EEXIST) {
33 perror("Could not create netreport file");
37 close(netreport_file);
40 /* ignore errors; not much we can do, won't hurt anything */
41 unlink(netreport_name);