From ecbc60bf55c2d913d65d903088fe776e8cb0915f Mon Sep 17 00:00:00 2001 From: dlukes <dlukes@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Sat, 31 Jan 2009 09:50:25 +0000 Subject: [PATCH] Damned GCC warn_unused_result warning can't be silenced by the normal ways ... So another try ... git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2727 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/smartd.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index cc23ebdc6..a1f1d39c5 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -138,7 +138,7 @@ extern const char *os_solaris_ata_s_cvsid; #ifdef _WIN32 extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_c_cvsid; #endif -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.436 2009/01/30 21:14:00 dlukes Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.437 2009/01/31 09:50:25 dlukes Exp $" ATACMDS_H_CVSID CONFIG_H_CVSID #ifdef DAEMON_WIN32_H_CVSID DAEMON_WIN32_H_CVSID @@ -1363,14 +1363,16 @@ void DaemonInit(){ FreeConsole(); #endif // __CYGWIN__ +#define NO_warn_unused_result(cmd) { if (cmd) {} ; } + // redirect any IO attempts to /dev/null for stdin i=open("/dev/null",O_RDWR); // stdout - (void)dup(i); + NO_warn_unused_result(dup(i)); // stderr - (void)dup(i); + NO_warn_unused_result(dup(i)); umask(0); - (void) chdir("/"); + NO_warn_unused_result(chdir("/")); if (do_fork) PrintOut(LOG_INFO, "smartd has fork()ed into background mode. New PID=%d.\n", (int)getpid()); -- GitLab