summary refs log tree commit diff
path: root/pwait.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-09-17 13:07:09 +0200
committerLeah Neukirchen <leah@vuxu.org>2018-09-17 13:07:09 +0200
commit0dcdc241208ab35654a9261d5e1cfa7b49da3212 (patch)
treebe8c636c92e6a878798550cc1b45262ee7a002b0 /pwait.c
parentb92fba5ca891fa6a1f4f3a6f12789b87ccc1b484 (diff)
downloadextrace-0dcdc241208ab35654a9261d5e1cfa7b49da3212.tar.gz
extrace-0dcdc241208ab35654a9261d5e1cfa7b49da3212.tar.xz
extrace-0dcdc241208ab35654a9261d5e1cfa7b49da3212.zip
pwait: prefix error messages with "pwait:"
Diffstat (limited to 'pwait.c')
-rw-r--r--pwait.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/pwait.c b/pwait.c
index d32589d..63c1d15 100644
--- a/pwait.c
+++ b/pwait.c
@@ -173,7 +173,7 @@ usage:
 
 	pids = calloc(argc, sizeof (pid_t));
 	if (!pids) {
-		perror("calloc");
+		perror("pwait: calloc");
 		exit(1);
 	}
 
@@ -181,13 +181,15 @@ usage:
 		errno = 0;
 		pid = strtol(argv[n], &end, 10);
 		if (pid <= 0 || *end || errno != 0) {
-			fprintf(stderr, "%s: invalid process id\n", argv[n]);
+			fprintf(stderr, "pwait: %s: invalid process id\n",
+			    argv[n]);
 			continue;
 		}
 		errno = 0;
 		kill(pid, 0);
 		if (errno == ESRCH) {
-			fprintf(stderr, "%s: no such process\n", argv[n]);
+			fprintf(stderr, "pwait: %s: no such process\n",
+			    argv[n]);
 			continue;
 		}
 
@@ -199,7 +201,7 @@ usage:
 
 	sk_nl = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
 	if (sk_nl == -1) {
-		perror("socket sk_nl error");
+		perror("pwait: socket sk_nl error");
 		exit(1);
 	}
 
@@ -212,7 +214,7 @@ usage:
 	kern_nla.nl_pid = 1;
 
 	if (bind(sk_nl, (struct sockaddr *)&my_nla, sizeof my_nla) == -1) {
-		perror("binding sk_nl error");
+		perror("pwait: binding sk_nl error");
 		goto close_and_exit;
 	}
 	nl_hdr = (struct nlmsghdr *)buff;
@@ -235,7 +237,8 @@ usage:
 	cn_hdr->len = sizeof (enum proc_cn_mcast_op);
 
 	if (send(sk_nl, nl_hdr, nl_hdr->nlmsg_len, 0) != nl_hdr->nlmsg_len) {
-		fprintf(stderr, "failed to send proc connector mcast ctl op!\n");
+		fprintf(stderr,
+		    "pwait: failed to send proc connector mcast ctl op!\n");
 		goto close_and_exit;
 	}