EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: [Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15
From: Martin Konrad via Core-talk <[email protected]>
To: [email protected]
Date: Thu, 25 Apr 2019 02:55:32 -0000
Martin Konrad has proposed merging ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15.

Requested reviews:
  EPICS Core Developers (epics-core)

For more details, see:
https://code.launchpad.net/~info-martin-konrad/epics-base/+git/epics-base/+merge/366496

Fix a bunch of compiler warnings.
-- 
Your team EPICS Core Developers is requested to review the proposed merge of ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15.
diff --git a/src/libCom/log/iocLogServer.c b/src/libCom/log/iocLogServer.c
index f42aa45..e707185 100644
--- a/src/libCom/log/iocLogServer.c
+++ b/src/libCom/log/iocLogServer.c
@@ -37,7 +37,7 @@
 
 static unsigned short ioc_log_port;
 static long ioc_log_file_limit;
-static char ioc_log_file_name[256];
+static char ioc_log_file_name[512];
 static char ioc_log_file_command[256];
 
 
@@ -866,7 +866,12 @@ static int setupSIGHUP(struct ioc_log_server *pserver)
  */
 static void sighupHandler(int signo)
 {
-	(void) write(sighupPipe[1], "SIGHUP\n", 7);
+    const char msg[] = "SIGHUP\n";
+    const ssize_t bytesWritten = write(sighupPipe[1], msg, sizeof(msg));
+    if (bytesWritten != sizeof(msg)) {
+        fprintf(stderr, "iocLogServer: failed to write to SIGHUP pipe because "
+                        "`%s'\n", strerror(errno));
+    }
 }
 
 
@@ -884,7 +889,10 @@ static void serviceSighupRequest(void *pParam)
 	/*
 	 * Read and discard message from pipe.
 	 */
-	(void) read(sighupPipe[0], buff, sizeof buff);
+	if (read(sighupPipe[0], buff, sizeof buff) <= 0) {
+        fprintf(stderr, "iocLogServer: failed to read from SIGHUP pipe because "
+                        "`%s'\n", strerror(errno));
+    };
 
 	/*
 	 * Determine new log file name.
diff --git a/src/std/rec/boRecord.c b/src/std/rec/boRecord.c
index 8818455..48cc484 100644
--- a/src/std/rec/boRecord.c
+++ b/src/std/rec/boRecord.c
@@ -329,9 +329,9 @@ static long get_enum_strs(DBADDR *paddr,struct dbr_enumStrs *pes)
     /*SETTING no_str=0 breaks channel access clients*/
     pes->no_str = 2;
     memset(pes->strs,'\0',sizeof(pes->strs));
-    strncpy(pes->strs[0],prec->znam,sizeof(prec->znam));
+    strncpy(pes->strs[0],prec->znam,sizeof(pes->strs[0]));
     if(*prec->znam!=0) pes->no_str=1;
-    strncpy(pes->strs[1],prec->onam,sizeof(prec->onam));
+    strncpy(pes->strs[1],prec->onam,sizeof(pes->strs[1]));
     if(*prec->onam!=0) pes->no_str=2;
     return(0);
 }
diff --git a/src/std/rec/stateRecord.c b/src/std/rec/stateRecord.c
index a052b07..8170de7 100644
--- a/src/std/rec/stateRecord.c
+++ b/src/std/rec/stateRecord.c
@@ -98,7 +98,7 @@ static void monitor(stateRecord *prec)
     monitor_mask = recGblResetAlarms(prec);
     if(strncmp(prec->oval,prec->val,sizeof(prec->val))) {
         db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG);
-	strncpy(prec->oval,prec->val,sizeof(prec->val));
+	strncpy(prec->oval,prec->val,sizeof(prec->oval));
     }
     return;
 }
diff --git a/src/std/rec/stringinRecord.c b/src/std/rec/stringinRecord.c
index db2f626..aac7d4e 100644
--- a/src/std/rec/stringinRecord.c
+++ b/src/std/rec/stringinRecord.c
@@ -120,7 +120,7 @@ static long init_record(stringinRecord *prec, int pass)
     if( pdset->init_record ) {
 	if((status=(*pdset->init_record)(prec))) return(status);
     }
-    strncpy(prec->oval, prec->val, sizeof(prec->val));
+    strncpy(prec->oval, prec->val, sizeof(prec->oval));
     return(0);
 }
 
@@ -160,7 +160,7 @@ static void monitor(stringinRecord *prec)
 
     if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
         monitor_mask |= DBE_VALUE | DBE_LOG;
-        strncpy(prec->oval, prec->val, sizeof(prec->val));
+        strncpy(prec->oval, prec->val, sizeof(prec->oval));
     }
 
     if (prec->mpst == stringinPOST_Always)
diff --git a/src/std/rec/stringoutRecord.c b/src/std/rec/stringoutRecord.c
index 2bca322..61d88f6 100644
--- a/src/std/rec/stringoutRecord.c
+++ b/src/std/rec/stringoutRecord.c
@@ -122,7 +122,7 @@ static long init_record(stringoutRecord *prec, int pass)
     if( pdset->init_record ) {
 	if((status=(*pdset->init_record)(prec))) return(status);
     }
-    strncpy(prec->oval, prec->val, sizeof(prec->val));
+    strncpy(prec->oval, prec->val, sizeof(prec->oval));
     return(0);
 }
 
@@ -188,7 +188,7 @@ static void monitor(stringoutRecord *prec)
 
     if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
         monitor_mask |= DBE_VALUE | DBE_LOG;
-        strncpy(prec->oval, prec->val, sizeof(prec->val));
+        strncpy(prec->oval, prec->val, sizeof(prec->oval));
     }
 
     if (prec->mpst == stringoutPOST_Always)

Replies:
Re: [Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15 Andrew Johnson via Core-talk
Re: [Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15 mdavidsaver via Core-talk
[Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15 noreply--- via Core-talk

Navigate by Date:
Prev: ICALEPCS 2019 Contributions Johnson, Andrew N. via Core-talk
Next: Re: ICALEPCS 2019 Contributions Timo Korhonen via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ICALEPCS 2019 Contributions Konrad, Martin via Core-talk
Next: Re: [Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15 Andrew Johnson via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 24 Jun 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·