[torquedev] small gcc compile error (gcc v 4.0.3)

Chris LeBlanc crleblanc at gmail.com
Sun Oct 28 22:03:26 MDT 2007


I just wanted to mention that the svn trunk line of Torque give a
compile error for the file src/cmds/qmgr.c when running under gcc
4.0.3 (Ubuntu 6.06, x86_64) using the stock configure options.  The
error message is:

> make
gcc -DHAVE_CONFIG_H -I. -I. -I../../src/include  -I../../src/include
-D_LARGEFILE_SOURCE -I/usr/local/Claritas/current/ -DBIT64 -W -Wall
-Wno-unused-parameter -Wno-long-long -pedantic -Werror
cc1: warnings being treated as errors
qmgr.c: In function 'execute':
qmgr.c:1502: warning: passing argument 2 of 'pstderr1' makes pointer
from integer without a cast
make: *** [qmgr.o] Error 1

It appears that on line 1502, its trying to pass an integer instead of
a char string to the function pstderr1().  I've created a patch, using
sprintf to make a copy of the integer in a string format.  The 'svn
diff' is below, hopefully its useful.

Chris LeBlanc

Index: src/cmds/qmgr.c
--- src/cmds/qmgr.c     (revision 1588)
+++ src/cmds/qmgr.c     (working copy)
@@ -1336,6 +1336,7 @@
   int len;                     /* Used for length of an err msg*/
   int error;                   /* Error value returned */
   int perr;                    /* Value returned from pbs_manager */
+  char pbs_errno_str[256];     /* String copy of the integer pbs_errno */
   char *errmsg;                        /* Error message from pbs_errmsg */
   char errnomsg[256];          /* Error message with pbs_errno */
   struct objname *name;                /* Pointer to a list of object names */
@@ -1498,8 +1499,11 @@
          pstderr("qmgr: Protocol error, server disconnected\n");
-       else
-         pstderr1("qmgr: Error (%d) returned from server\n", pbs_errno);
+       else
+        {
+         sprintf(pbs_errno_str, "%d", pbs_errno);
+         pstderr1("qmgr: Error (%s) returned from server\n", pbs_errno_str);
+        }

        if ( aopt )
          return perr;

More information about the torquedev mailing list