← Commit list

754e9f96d

Denys Vlasenko
Denys Vlasenko
2017-08-05
SUCCESS Duration: 140s

Subject

svc: fix a case where with more than option, getopt() state is not reset

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

runit/sv.c+6 -5
@@ -718,15 +718,16 @@ int svc_main(int argc UNUSED_PARAM, char **argv)
argv[1] = command;
command[1] = '\0';
- /* getopt32() was already called:
- * reset the libc getopt() function, which keeps internal state.
- */
- GETOPT_RESET();
-
do {
if (opts & 1) {
int r;
+
command[0] = *optstring;
+
+ /* getopt() was already called by getopt32():
+ * reset the libc getopt() function's internal state.
+ */
+ GETOPT_RESET();
r = sv(argv);
if (r)
return 1;