check for right number of arguments _after_ the option parsing.
authorAndrew Tridgell <tridge@samba.org>
Sat, 16 May 1998 15:18:07 +0000 (15:18 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 16 May 1998 15:18:07 +0000 (15:18 +0000)
this stops "rsync -v" causing a segv.

main.c

diff --git a/main.c b/main.c
index 0a57af6..f557e55 100644 (file)
--- a/main.c
+++ b/main.c
@@ -492,6 +492,11 @@ int main(int argc,char *argv[])
        argv += optind;
        optind = 0;
 
+       if (argc < 1) {
+               usage(FERROR);
+               exit(1);
+       }
+
        signal(SIGCHLD,SIG_IGN);
        signal(SIGINT,SIGNAL_CAST sig_int);
        signal(SIGPIPE,SIGNAL_CAST sig_int);