File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,13 @@ runroot rpm2archive "${RPMTEST}"/data/SRPMS/hello-1.0-1.src.rpm | tar tzf -
457457[./hello-1.0.tar.gz
458458./hello.spec
459459])
460+ RPMTEST_CHECK([
461+ runroot rpm2archive "${RPMTEST}"/data/SRPMS/hello-1.0-1.src.rpm -
462+ ],
463+ [1],
464+ [],
465+ [No other arguments allowed beside of -
466+ ])
460467
461468RPMTEST_CLEANUP
462469
Original file line number Diff line number Diff line change @@ -287,6 +287,8 @@ int main(int argc, char *argv[])
287287 int rc = 0 ;
288288 poptContext optCon;
289289 const char *fn;
290+ int arg_stdin = 0 ;
291+ int args = 0 ;
290292
291293 xsetprogname (argv[0 ]); /* Portability call -- see system.h */
292294 rpmReadConfigFiles (NULL , NULL );
@@ -324,6 +326,18 @@ int main(int argc, char *argv[])
324326 goto exit;
325327 }
326328
329+ /* Make sure - is given as a lone argument */
330+ for (const char ** arg = poptGetArgs (optCon); *arg; arg++){
331+ if (!strcmp (*arg, " -" ))
332+ arg_stdin = 1 ;
333+ args++;
334+ }
335+ if (arg_stdin && args > 1 ) {
336+ fprintf (stderr, " No other arguments allowed beside of -\n " );
337+ rc = 1 ;
338+ goto exit;
339+ }
340+
327341 while ((fn = poptGetArg (optCon)) != NULL ) {
328342 rc = process_package (ts, fn);
329343 if (rc != 0 )
You can’t perform that action at this time.
0 commit comments