aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorChen Gang <gang.chen@sunrus.com.cn>2015-01-09 10:40:42 +0800
committerPedro Alves <palves@redhat.com>2015-01-09 09:18:32 +0000
commit3ce348af7f45f00d5acbdc4e1ef22c5f14724408 (patch)
tree01244382db975135e235fb02a221a457bd2a7689 /gdb/compile
parent1c237a09afdecc5a68fd5b566abba28503333148 (diff)
downloadgdb-3ce348af7f45f00d5acbdc4e1ef22c5f14724408.zip
gdb-3ce348af7f45f00d5acbdc4e1ef22c5f14724408.tar.gz
gdb-3ce348af7f45f00d5acbdc4e1ef22c5f14724408.tar.bz2
gdb/compile/compile.c: Check return value of 'system' to avoid compiler warning
Under Ubuntu 12, we need to check the return value of system(), or the compiler warns: gcc -g -O2 -I. -I../../binutils-gdb/gdb -I../../binutils-gdb/gdb/common -I../../binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../binutils-gdb/gdb/../include/opcode -I../../binutils-gdb/gdb/../opcodes/.. -I../../binutils-gdb/gdb/../readline/.. -I../bfd -I../../binutils-gdb/gdb/../bfd -I../../binutils-gdb/gdb/../include -I../libdecnumber -I../../binutils-gdb/gdb/../libdecnumber -I../../binutils-gdb/gdb/gnulib/import -Ibuild-gnulib/import -DTUI=1 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o compile.o -MT compile.o -MMD -MP -MF .deps/compile.Tpo ../../binutils-gdb/gdb/compile/compile.c ../../binutils-gdb/gdb/compile/compile.c: In function ‘do_rmdir’: ../../binutils-gdb/gdb/compile/compile.c:175:10: error: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Werror=unused-result] cc1: all warnings being treated as errors make[2]: *** [compile.o] Error 1 make[2]: Leaving directory `/upstream/build-binutils-s390/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/upstream/build-binutils-s390' make: *** [all] Error 2 Also, 'zap' is leaking. 2015-01-09 Chen Gang <gang.chen.5i5j@gmail.com> Pedro Alves <palves@redhat.com> * compile/compile.c: Include "gdb_wait.h". (do_rmdir): Check return value, and free 'zap'.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 1d18bd7..ccac49d 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -37,6 +37,7 @@
#include "filestuff.h"
#include "target.h"
#include "osabi.h"
+#include "gdb_wait.h"
@@ -169,10 +170,14 @@ do_rmdir (void *arg)
{
const char *dir = arg;
char *zap;
-
+ int wstat;
+
gdb_assert (strncmp (dir, TMP_PREFIX, strlen (TMP_PREFIX)) == 0);
zap = concat ("rm -rf ", dir, (char *) NULL);
- system (zap);
+ wstat = system (zap);
+ if (wstat == -1 || !WIFEXITED (wstat) || WEXITSTATUS (wstat) != 0)
+ warning (_("Could not remove temporary directory %s"), dir);
+ XDELETEVEC (zap);
}
/* Return the name of the temporary directory to use for .o files, and