Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] groff, fix pushback.cpp dup warnings

2 views
Skip to first unread message

g....@free.fr

unread,
Feb 2, 2013, 9:04:23 AM2/2/13
to bug-...@gnu.org
Fix those warnings
pushback.cpp: In destructor 'pushBackBuffer::~pushBackBuffer()':
pushback.cpp:90: warning: ignoring return value of 'int dup(int)', declared with attribute warn_unused_result
pushback.cpp: In destructor 'pushBackBuffer::~pushBackBuffer()':
pushback.cpp:90: warning: ignoring return value of 'int dup(int)', declared with attribute warn_unused_result
pushback.cpp: In destructor 'pushBackBuffer::~pushBackBuffer()':
pushback.cpp:90: warning: ignoring return value of 'int dup(int)', declared with attribute warn_unused_result

visible on unhardened gcc-4.4 with PAGE=letter ./configure --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" && make

Patch is attached too if inline version is wrapped

Gilles

Index: src/preproc/html/pushback.cpp
===================================================================
RCS file: /sources/groff/groff/src/preproc/html/pushback.cpp,v
retrieving revision 1.8
diff -u -r1.8 pushback.cpp
--- src/preproc/html/pushback.cpp 5 Jan 2009 20:11:08 -0000 1.8
+++ src/preproc/html/pushback.cpp 2 Feb 2013 13:38:43 -0000
@@ -71,6 +71,9 @@
lineNo = 1;
if (strcmp(filename, "") != 0) {
stdIn = dup(0);
+ if (stdIn<0) {
+ sys_fatal("dup stdin");
+ }
close(0);
if (open(filename, O_RDONLY) != 0) {
sys_fatal("when trying to open file");
@@ -87,7 +90,9 @@
}
close(0);
/* restore stdin in file descriptor 0 */
- dup(stdIn);
+ if (dup(stdIn)<0) {
+ sys_fatal("restore stdin");
+ }
close(stdIn);
}

groff_dup.patch

Werner LEMBERG

unread,
Feb 2, 2013, 2:05:43 PM2/2/13
to g....@free.fr, bug-...@gnu.org

> Fix those warnings [...]

Patch applied, thanks.


Werner

0 new messages