Permalink
Browse files

wrapper: show the program's name in major messages

Since this wrapper program is typically used in an "automatic"
(non-interactive) way, it may be helpful to the user to include the
program's name in some of the messages it prints.

Add the program's name to the following messages:

 * The "unsupported old/new OS" messages may appear by themselves
   (e.g. before the wrapper is updated to handle a new OS X release).

 * The message after the reattach_failed label will also be issued
   after any earlier message (except the old/new OS message).

 * The message for a failed exec.

Suggested-By: #14
  • Loading branch information...
1 parent ec6cdf5 commit 3c1756ec1e57a04f36baaa03dcf94ef42c06fa4b @ChrisJohnsen committed Aug 2, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 reattach-to-user-namespace.c
@@ -114,10 +114,10 @@ int main(int argc, char *argv[]) {
if (1060 <= os && os <= 1080)
os = 1060;
else if (os < 1050) {
- warn("unsupported old OS, trying as if it were 10.5");
+ warn("%s: unsupported old OS, trying as if it were 10.5", argv[0]);
os = 1050;
} else if (os > 1060) {
- warn("unsupported new OS, trying as if it were 10.6-10.8");
+ warn("%s: unsupported new OS, trying as if it were 10.6-10.8", argv[0]);
os = 1060;
}
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
break;
default:
reattach_failed:
- warn("unable to reattach");
+ warn("%s: unable to reattach", argv[0]);
break;
}
@@ -199,7 +199,7 @@ int main(int argc, char *argv[]) {
exec_it:
if (execvp(file, newargs ? newargs : argv+1) < 0)
- die_errno(3, "execv failed");
+ die_errno(3, "%s: execv failed", argv[0]);
if (newargs) {
free(newargs[0]);

0 comments on commit 3c1756e

Please sign in to comment.