also sprach rsocha:
> * Peter Green <[EMAIL PROTECTED]> [000925 09:03]:
> > I've got this working with 2.8.12;
> 
> I cannot compile qmail-mrtg under OpenBSD 2.7:
> (root@purgatory):(/usr/local/src/Qmail/qmail-mrtg.1.0)# gcc --version
> 2.95.2
> (root@purgatory):(/usr/local/src/Qmail/qmail-mrtg.1.0)# gcc -o
> qmail-mrtg qmail-mrtg.c
> qmail-mrtg.c: In function `main':
> qmail-mrtg.c:81: too few arguments to function `strncmp'

Ick, *really* sloppy programming by the author. He used strncmp (``compare
the first N characters of two strings'') without providing the length
(``N''). Try the attached patch (untested, but believed functional).

/pg
-- 
Peter Green : Gospel Communications Network, SysAdmin : [EMAIL PROTECTED]
---
I hope if dogs ever take over the world and they choose a king, they don't 
just go by size, because I bet there are some Chihuahuas with some good 
ideas.
 (Jack Handey)

--- qmail-mrtg.c.orig   Mon Sep 25 09:41:50 2000
+++ qmail-mrtg.c        Mon Sep 25 09:42:28 2000
@@ -78,7 +78,7 @@
                                } 
 
                        }
-                       if(!strncmp(argv[1],"-v")) {
+                       if(!strncmp(argv[1],"-v",2)) {
                                printf("%lu.%lu ",seconds, nanoseconds);
                                printf("%s\n",buff);
                        }
@@ -107,23 +107,23 @@
                        }
                }
     }
-       if(!strncmp(argv[1],"-1")) {
+       if(!strncmp(argv[1],"-1",2)) {
                printf("%i\n",success);
                printf("%i\n",failure);
                printf("\n");
                printf("\n");
        }
-       if(!strncmp(argv[1],"-2")) {
+       if(!strncmp(argv[1],"-2",2)) {
                printf("%i\n",bytes/1024);
                printf("%i\n",bytes/1024);
        }
-       if(!strncmp(argv[1],"-3")) {
+       if(!strncmp(argv[1],"-3",2)) {
                printf("%i\n",local);
                printf("%i\n",remote);
                printf("\n");
                printf("\n");                           
        }
-       if(!strncmp(argv[1],"-4")) {
+       if(!strncmp(argv[1],"-4",2)) {
                printf("%i\n",success);
                printf("%i\n",failure+success);
                printf("\n");

Reply via email to