LP#1243841 - Quiet unused return value warnings.
authorChris Sharp <csharp@georgialibraries.org>
Wed, 20 Sep 2017 00:37:13 +0000 (20:37 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 May 2018 19:53:42 +0000 (15:53 -0400)
Using advice given here: https://stackoverflow.com/a/13999461, "The
only good (if ugly) way to suppress these is to convert the return
value into something that the compiler agrees that you can ignore."

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
src/libopensrf/utils.c

index 1c049c0..ff0afc3 100644 (file)
@@ -667,16 +667,16 @@ int daemonizeWithCallback( void (*callback)(pid_t, int), int callback_arg ) {
                // Change directories.  Otherwise whatever directory
                // we're in couldn't be deleted until the program
                // terminated -- possibly causing some inconvenience.
-               chdir( "/" );
+               (void) (chdir( "/" )+1);
 
                /* create new session */
                setsid();
 
                // Now that we're no longer attached to a terminal,
                // we don't want any traffic on the standard streams
-               freopen( "/dev/null", "r", stdin );
-               freopen( "/dev/null", "w", stdout );
-               freopen( "/dev/null", "w", stderr );
+               (void) (freopen( "/dev/null", "r", stdin )+1);
+               (void) (freopen( "/dev/null", "w", stdout )+1);
+               (void) (freopen( "/dev/null", "w", stderr )+1);
                
                return 0;