trivial ciped.c patch

View: New views
1 Messages — Rating Filter:   Alert me  

trivial ciped.c patch

by Anatoly Pugachev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.
Small patch to make broken options and help to shown before we check for user
privileges. Please apply.
--
Anatoly P. Pugachev

Only in cipe-1.6.0/: 2.6.9-5.EL-i386-cb
diff -ru cipe-1.6.0.orig/cipe/ciped.c cipe-1.6.0/cipe/ciped.c
--- cipe-1.6.0.orig/cipe/ciped.c 2004-01-18 17:57:51.000000000 +0300
+++ cipe-1.6.0/cipe/ciped.c 2005-06-12 04:29:27.949491296 +0400
@@ -934,6 +934,16 @@
     else
  pn=argv[0];
 
+    while ((i=getopt(argc, argv, "is:S:o:"))!=EOF) {
+        switch(i) {
+        case 'i': inetd=1; break;
+ case 's': usesock=atoi(optarg); break;
+ case 'S': sd=atoi(optarg); break;
+        case 'o': if (setopt_file(optarg, 1)<0) exit(1); break;
+        default: usage(pn);
+        }
+    }
+
     if (getuid() || geteuid()) {
  fprintf(stderr, "This program must be run by root.\n");
  exit(1);
@@ -952,15 +962,6 @@
     /* Snarf options from: standard options file, user-supplied file and
        finally, command line */
     setopt_file(CTLDIR "/options", 0);
-    while ((i=getopt(argc, argv, "is:S:o:"))!=EOF) {
-        switch(i) {
-        case 'i': inetd=1; break;
- case 's': usesock=atoi(optarg); break;
- case 'S': sd=atoi(optarg); break;
-        case 'o': if (setopt_file(optarg, 1)<0) exit(1); break;
-        default: usage(pn);
-        }
-    }
     setopt_cmdline(argc-optind, argv+optind);
     if (!OI(maxerr))
  OI(maxerr)=8; /* compatibility */


attachment0 (196 bytes) Download Attachment
LightInTheBox - Buy quality products at wholesale price!