cc1plus: warnings being treated as errors
/home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp: In function ‘int popen2(const char*, FILE**, FILE**, pid_t*)’:
/home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp:76: error: ignoring return value of ‘int dup(int)’, declared with attribute warn_unused_result
/home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp:77: error: ignoring return value of ‘int dup(int)’, declared with attribute warn_unused_result
make[2]: *** [libproxy/CMakeFiles/config_gnome.dir/modules/config_gnome.cpp.o] Error 1
The following patch fixes this problem.
Thanks,
Aron
Index: libproxy/modules/config_gnome.cpp
===================================================================
--- libproxy/modules/config_gnome.cpp (revision 609)
+++ libproxy/modules/config_gnome.cpp (working copy)
@@ -73,8 +73,8 @@
close(STDIN_FILENO); // Close stdin
close(STDOUT_FILENO); // Close stdout
- dup(wpipe[0]); // Dup the read end of the write pipe to stdin
- dup(rpipe[1]); // Dup the write end of the read pipe to stdout
+ dup2(wpipe[0], STDIN_FILENO); // Dup the read end of the write pipe to stdin
+ dup2(rpipe[1], STDOUT_FILENO); // Dup the write end of the read pipe to stdout
// Close unneeded fds
close(rpipe[0]);
Thanks!
On 03/08/2010 09:45 PM, Aron Griffis wrote:
> Building on Ubuntu Lucid I get the following:
>
> cc1plus: warnings being treated as errors
> /home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp: In function �int popen2(const char*, FILE**, FILE**, pid_t*)�:
> /home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp:76: error: ignoring return value of �int dup(int)�, declared with attribute warn_unused_result
> /home/agriffis/proj/libproxy/libproxy/modules/config_gnome.cpp:77: error: ignoring return value of �int dup(int)�, declared with attribute warn_unused_result