From e8d7eb88b6a828c4c5693db6fb30f60b683ddcb3 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 20 Apr 2026 23:39:42 +0200 Subject: [PATCH] Fix nwconn and nwqconn signal and 64-bit related warnings --- src/nwconn.c | 12 ++++++------ src/nwqconn.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/nwconn.c b/src/nwconn.c index 0a7d1fb..62b252e 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -2607,10 +2607,10 @@ static void handle_sigusr2(void) FILE *f; fl_get_int &= ~8; sprintf(fn, "/tmp/nwconn%04d.log", act_connection); - seteuid(0); + if (seteuid(0)) {} unlink(fn); /* security: mst:18-Apr-00 */ f=fopen(fn, "w"); - reseteuid(); + (void)reseteuid(); if (f) { log_file_module(f); fclose(f); @@ -2653,12 +2653,12 @@ int main(int argc, char **argv) } #endif prog_title=argv[3]; - setuid(0); - setgid(0); + if (setuid(0)) {} + if (setgid(0)) {} act_connection = atoi(*(argv+1)); #if !CALL_NWCONN_OVER_SOCKET nwconn_state = shmat(shm_id, NULL, SHM_W); - if ((int )(nwconn_state) == -1) { + if (nwconn_state == (char *)-1) { errorp(0, "Can't attach shared memory segment", NULL); exit(1); } @@ -2802,7 +2802,7 @@ int main(int argc, char **argv) } } /* while */ - seteuid(0); + if (seteuid(0)) {} # ifdef SIOCIPXNCPCONN { int conn = -act_connection; diff --git a/src/nwqconn.c b/src/nwqconn.c index b1cc7e1..90e174e 100644 --- a/src/nwqconn.c +++ b/src/nwqconn.c @@ -209,7 +209,7 @@ int close_queue_job2(uint32 q_id, int job_id, XDPRINTF((5,0,"nw_close_file_queue fhandle=%d", jo->fhandle)); if (*unixname) { char buff[1024]; - char printcommand[300]; + char printcommand[1400]; FILE *f=NULL; if (prc_len && *(prc+prc_len-1)=='!'){ strmaxcpy((uint8*)buff, prc, prc_len-1); @@ -221,7 +221,7 @@ int close_queue_job2(uint32 q_id, int job_id, jo->fhandle = 0L; if (NULL == (f = fopen(unixname, "r"))) { /* OK now we try the open as root */ - seteuid(0); + if (seteuid(0)) {} f = fopen(unixname, "r"); reset_guid(); } @@ -247,7 +247,7 @@ int close_queue_job2(uint32 q_id, int job_id, } fclose(f); if (is_ok) { - seteuid(0); + if (seteuid(0)) {} unlink(unixname); reset_guid(); result=0;