[torquedev] [PATCH] Fix Torque compilation for picky compiler
Tobias Burnus
burnus at net-b.de
Fri Apr 25 07:33:51 MDT 2008
Hello,
Below you find some compile fixes needed for a particularly picky
compiler. I would be happy if you could include those in your next release.
(If you wonder which compiler this is: It is GCC 4.3.0 with some patch
by SUSE which checks the prototype declaration; the patch was needed to
get Torque to build with openSUSE Factory on the build server; the
Torque RPM packages are downloadable at http://software.opensuse.org/search)
Thanks,
Tobias
My compiler complains when compiling Torque with the following message:
|../Libnet/md5.c:146: error: call to function 'Transform' without a real
prototype
../Libnet/md5.c:52: note: 'Transform' was declared here
../Libnet/md5.c: In function 'MD5Final':
../Libnet/md5.c:180: error: call to function 'Transform' without a real
prototype
../Libnet/md5.c:52: note: 'Transform' was declared here
which is fixed by the attached patch.| The "start_exec" part of the
patch is to fix a sign problem. MD5Update expects unsigned char*, but
caddr_t is "char *", which is signed.
|
Additionally, it complained that for freopen the return value
was not checked; I fixed this using:
**************************************
--- ../torque-2.3.0.orig/src/scheduler.cc/pbs_sched.c 2008-03-06
22:29:03.000000000 +0100
+++ ./src/scheduler.cc/pbs_sched.c 2008-04-01 18:11:58.000000000 +0200
@@ -981,7 +981,13 @@
lock_out(lockfds, F_WRLCK);
- freopen(dbfile, "a", stdout);
+ if (freopen(dbfile, "a", stdout) == NULL)
+ {
+ perror("opening lockfile");
+
+ exit(1);
+ }
+
setvbuf(stdout, NULL, _IOLBF, 0);
@@ -995,7 +1001,12 @@
pid = getpid();
}
- freopen("/dev/null", "r", stdin);
+ if (freopen("/dev/null", "r", stdin) == NULL)
+ {
+ perror("opening /dev/null");
+
+ exit(1);
+ }
/* write scheduler's pid into lockfile */
||**************************************|
-------------- next part --------------
Thu Apr 24 10:32:28 CEST 2008 Tobias Burnus <burnus at net-b.de>
Fix prototype declaration for -Wunprototyped-calls.
diff -r -p -u ../torque-2.3.0.orig//doc/soelim.c .//doc/soelim.c
--- ../torque-2.3.0.orig//doc/soelim.c 2008-03-06 22:29:12.000000000 +0100
+++ .//doc/soelim.c 2008-04-24 14:57:55.000000000 +0200
@@ -102,7 +102,7 @@ int main(argc, argv)
int argc;
char *argv[];
{
- int dofile();
+ int dofile(FILE *);
int dirct = 0;
FILE *filein;
int i;
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qdisable.c .//src/cmds/qdisable.c
--- ../torque-2.3.0.orig//src/cmds/qdisable.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qdisable.c 2008-04-24 13:19:46.000000000 +0200
@@ -110,7 +110,7 @@
int exitstatus = 0; /* Exit Status */
-static void execute ();
+static void execute (char *, char *);
int main ( argc, argv )
int argc;
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qenable.c .//src/cmds/qenable.c
--- ../torque-2.3.0.orig//src/cmds/qenable.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qenable.c 2008-04-24 13:27:49.000000000 +0200
@@ -109,7 +109,7 @@
int exitstatus = 0; /* Exit Status */
-static void execute ();
+static void execute (char *, char *);
int main(
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qrun.c .//src/cmds/qrun.c
--- ../torque-2.3.0.orig//src/cmds/qrun.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qrun.c 2008-04-24 13:36:27.000000000 +0200
@@ -101,7 +101,7 @@
#include <pbs_config.h> /* the master config generated by configure */
int exitstatus = 0; /* Exit Status */
-static void execute();
+static void execute(char *, char *, char *, int);
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qstart.c .//src/cmds/qstart.c
--- ../torque-2.3.0.orig//src/cmds/qstart.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qstart.c 2008-04-24 13:36:39.000000000 +0200
@@ -108,7 +108,7 @@
int exitstatus = 0; /* Exit Status */
-static void execute ();
+static void execute (char *, char *);
int main (
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qstop.c .//src/cmds/qstop.c
--- ../torque-2.3.0.orig//src/cmds/qstop.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qstop.c 2008-04-24 13:36:48.000000000 +0200
@@ -108,7 +108,7 @@
int exitstatus = 0; /* Exit Status */
-static void execute ();
+static void execute (char *, char *);
int main ( argc, argv )
diff -r -p -u ../torque-2.3.0.orig//src/cmds/qterm.c .//src/cmds/qterm.c
--- ../torque-2.3.0.orig//src/cmds/qterm.c 2008-03-06 22:28:55.000000000 +0100
+++ .//src/cmds/qterm.c 2008-04-24 13:37:00.000000000 +0200
@@ -113,7 +113,7 @@
int exitstatus = 0; /* Exit Status */
-static void execute();
+static void execute(int, char *);
int main(
diff -r -p -u ../torque-2.3.0.orig//src/include/md5.h .//src/include/md5.h
--- ../torque-2.3.0.orig//src/include/md5.h 2008-03-06 22:28:54.000000000 +0100
+++ .//src/include/md5.h 2008-04-24 13:03:03.000000000 +0200
@@ -55,9 +55,9 @@ typedef struct {
unsigned char digest[16]; /* actual digest after MD5Final call */
} MD5_CTX;
-void MD5Init ();
-void MD5Update ();
-void MD5Final ();
+void MD5Init (MD5_CTX *);
+void MD5Update (MD5_CTX *, unsigned char *, unsigned int);
+void MD5Final (MD5_CTX *);
#define __MD5_INCLUDE__
#endif /* __MD5_INCLUDE__ */
diff -r -p -u ../torque-2.3.0.orig//src/include/mom_func.h .//src/include/mom_func.h
--- ../torque-2.3.0.orig//src/include/mom_func.h 2008-03-06 22:28:54.000000000 +0100
+++ .//src/include/mom_func.h 2008-04-24 12:52:13.000000000 +0200
@@ -149,7 +149,7 @@ extern void set_globid A_((job *, struc
extern int set_mach_vars A_((job *, struct var_table *));
extern char *set_shell A_((job *, struct passwd *));
extern void start_exec A_((job *));
-extern int open_master();
+extern int open_master(char **);
extern int open_slave();
extern char *rcvttype A_((int));
extern int rcvwinsize A_((int));
diff -r -p -u ../torque-2.3.0.orig//src/include/qmgr.h .//src/include/qmgr.h
--- ../torque-2.3.0.orig//src/include/qmgr.h 2008-03-06 22:28:54.000000000 +0100
+++ .//src/include/qmgr.h 2008-04-24 14:14:18.000000000 +0200
@@ -166,30 +166,30 @@ struct objname
/* prototypes */
-struct objname *commalist2objname();
-struct server *find_server();
+struct objname *commalist2objname(char *, int);
+struct server *find_server(char *);
struct server *make_connection();
struct server *new_server();
struct objname *new_objname();
-struct objname *strings2objname( );
+struct objname *strings2objname(char **, int, int);
struct objname *default_server_name();
-struct objname *temp_objname();
-int parse_request( );
-void clean_up_and_exit();
-void freeattrl();
-void freeattropl();
-void pstderr_big();
-void free_objname_list();
-void free_server();
-void free_objname();
+struct objname *temp_objname(char *, char *, struct server *);
+int parse_request(char *, char [][MAX_REQ_WORD_LEN]);
+void clean_up_and_exit(int);
+void freeattrl(struct attrl *);
+void freeattropl(struct attropl *);
+void pstderr_big(char *, char*, char *);
+void free_objname_list(struct objname *);
+void free_server(struct server *);
+void free_objname(struct objname *);
void close_non_ref_servers();
-int connect_servers();
-int set_active();
-int get_request();
-int parse();
-int execute();
-int is_attr();
-int is_valid_object();
+int connect_servers(struct objname *, int);
+int set_active(int, struct objname *);
+int get_request(char *);
+int parse(char *, int *, int *, char **, struct attropl **);
+int execute(int, int, int, char *, struct attropl *);
+int is_attr(int, char *, int);
+int is_valid_object(struct objname *, int);
void disconnect_from_server();
diff -r -p -u ../torque-2.3.0.orig//src/lib/Libnet/md5.c .//src/lib/Libnet/md5.c
--- ../torque-2.3.0.orig//src/lib/Libnet/md5.c 2008-03-06 22:29:09.000000000 +0100
+++ .//src/lib/Libnet/md5.c 2008-04-24 10:27:41.000000000 +0200
@@ -49,7 +49,7 @@
*/
/* forward declaration */
-static void Transform ();
+static void Transform (UINT4 *, UINT4 *);
static unsigned char PADDING[64] = {
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff -r -p -u ../torque-2.3.0.orig//src/lib/Libnet/net_server.c .//src/lib/Libnet/net_server.c
--- ../torque-2.3.0.orig//src/lib/Libnet/net_server.c 2008-03-06 22:29:09.000000000 +0100
+++ .//src/lib/Libnet/net_server.c 2008-04-24 11:08:33.000000000 +0200
@@ -115,7 +115,7 @@ extern int LOGLEVEL;
extern void process_request A_((int));
-extern time_t time();
+extern time_t time(time_t *);
/* Global Data (I wish I could make it private to the library, sigh, but
* C don't support that scope of control.)
diff -r -p -u ../torque-2.3.0.orig//src/resmom/start_exec.c .//src/resmom/start_exec.c
--- ../torque-2.3.0.orig//src/resmom/start_exec.c 2008-03-06 22:29:05.000000000 +0100
+++ .//src/resmom/start_exec.c 2008-04-24 13:11:05.000000000 +0200
@@ -4644,9 +4644,9 @@ void start_exec(
MD5Init(&c);
- MD5Update(&c,(caddr_t)&loopcnt,sizeof(loopcnt));
+ MD5Update(&c,(unsigned char *)&loopcnt,sizeof(loopcnt));
- MD5Update(&c,(caddr_t)pjob,sizeof(job));
+ MD5Update(&c,(unsigned char *)pjob,sizeof(job));
MD5Final(&c);
diff -r -p -u ../torque-2.3.0.orig//src/server/req_stat.c .//src/server/req_stat.c
--- ../torque-2.3.0.orig//src/server/req_stat.c 2008-03-06 22:29:06.000000000 +0100
+++ .//src/server/req_stat.c 2008-04-24 11:56:13.000000000 +0200
@@ -119,7 +119,7 @@ extern attribute_def node_attr_def[];
extern int pbs_mom_port;
extern time_t time_now;
extern char *msg_init_norerun;
-extern struct pbsnode *tfind_addr();
+extern struct pbsnode *tfind_addr(const u_long);
extern int LOGLEVEL;
/* Extern Functions */
More information about the torquedev
mailing list