Skip to content
This repository
Browse code

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...
commit 3c1756ec1e57a04f36baaa03dcf94ef42c06fa4b 1 parent ec6cdf5
Chris Johnsen authored

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 4 reattach-to-user-namespace.c
8 reattach-to-user-namespace.c
@@ -114,10 +114,10 @@ int main(int argc, char *argv[]) {
114 114 if (1060 <= os && os <= 1080)
115 115 os = 1060;
116 116 else if (os < 1050) {
117   - warn("unsupported old OS, trying as if it were 10.5");
  117 + warn("%s: unsupported old OS, trying as if it were 10.5", argv[0]);
118 118 os = 1050;
119 119 } else if (os > 1060) {
120   - warn("unsupported new OS, trying as if it were 10.6-10.8");
  120 + warn("%s: unsupported new OS, trying as if it were 10.6-10.8", argv[0]);
121 121 os = 1060;
122 122 }
123 123
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
161 161 break;
162 162 default:
163 163 reattach_failed:
164   - warn("unable to reattach");
  164 + warn("%s: unable to reattach", argv[0]);
165 165 break;
166 166 }
167 167
@@ -199,7 +199,7 @@ int main(int argc, char *argv[]) {
199 199
200 200 exec_it:
201 201 if (execvp(file, newargs ? newargs : argv+1) < 0)
202   - die_errno(3, "execv failed");
  202 + die_errno(3, "%s: execv failed", argv[0]);
203 203
204 204 if (newargs) {
205 205 free(newargs[0]);

0 comments on commit 3c1756e

Please sign in to comment.
Something went wrong with that request. Please try again.