chiark / gitweb /
prefork: Insist on script (separately) with combined options
[chiark-utils.git] / cprogs / prefork.c
index 095dd44e89d2778c5241568e1cd5bfff0f565cc8..425974c0ad5979aa6628aa20aee7dd661bd07407 100644 (file)
@@ -2,14 +2,13 @@
 
 #include "prefork.h"
 
-const char *interp, *ident;
-
+const char *interp, *ident, *script, *socket_path, *lock_path;
+bool logging;
 struct sha256_ctx identsc;
 
-uid_t us;
-const char *run_base, *script, *socket_path, *lock_path;
-const char *run_base_mkdir_p;
-bool logging;
+static uid_t us;
+static const char *run_base;
+static const char *run_base_mkdir_p;
 
 void common_diee(const char *m) { diee("%s", m); }
 void common_die (const char *m) { die ("%s", m); }
@@ -234,6 +233,9 @@ void process_opts(const char *const **argv_io) {
 
     shbang_opts(&split_argv, cmdinfos);
     /* sets interp */
+
+    if (!**argv_io)
+      badusage("no script argument (expected after combined #! options)");
   } else {
     shbang_opts(argv_io, cmdinfos);
   }