]> ruderich.org/simon Gitweb - wall-notify/wall-notify.git/commitdiff
cleanup argv passing to notification program
authorSimon Ruderich <simon@ruderich.org>
Tue, 13 May 2014 23:04:56 +0000 (01:04 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 13 May 2014 23:04:56 +0000 (01:04 +0200)
src/wall-notify.c

index 24afb7a1f90295f3cf69e80e6815dbbbb189e10a..7fb3b33cbc0bdaaf2e7436abf77bd7ca4b8d4fa1 100644 (file)
@@ -205,9 +205,6 @@ static void pass_buffer_to_program(const char *buffer, size_t length, char **arg
 
     pid_t pid;
 
-    /* Skip argv[0]. */
-    argv++;
-
     if (pipe(fds) != 0) {
         perror("pipe");
         return;
@@ -303,9 +300,14 @@ static void usage(const char *argv0) {
 int main(int argc, char **argv) {
     int ptm, pts;
     char *name;
+    const char *argv0;
+
+    argv0 = argv[0];
+    /* Don't pass our argv[0] to the notification program. */
+    argv++;
 
     if (argc < 2) {
-        usage(argv[0]);
+        usage(argv0);
     }
 
     ptm = open_tty();