From 3054ed120a0363007c607ac6c20458ec2d5bd183 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 7 Dec 2008 10:57:43 +0000 Subject: [PATCH] Clean up gcc-4.3 warnings git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10971 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CCache/ccache.c | 4 +++- CCache/stats.c | 2 +- CCache/util.c | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CCache/ccache.c b/CCache/ccache.c index 9b12d3bf7..3d5f13633 100644 --- a/CCache/ccache.c +++ b/CCache/ccache.c @@ -157,7 +157,9 @@ static const char *tmp_string(void) gethostname(hostname, sizeof(hostname)-1); #endif hostname[sizeof(hostname)-1] = 0; - asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()); + if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) { + fatal("could not allocate tmp_string"); + } } return ret; diff --git a/CCache/stats.c b/CCache/stats.c index 8be1879d1..f87264794 100644 --- a/CCache/stats.c +++ b/CCache/stats.c @@ -91,7 +91,7 @@ static void write_stats(int fd, unsigned counters[STATS_END]) if (len >= (int)sizeof(buf)-1) fatal("stats too long?!"); lseek(fd, 0, SEEK_SET); - write(fd, buf, len); + if (write(fd, buf, len) == -1) fatal("could not write stats"); } diff --git a/CCache/util.c b/CCache/util.c index 06b290954..8e39b9c21 100644 --- a/CCache/util.c +++ b/CCache/util.c @@ -442,7 +442,9 @@ void x_asprintf(char **ptr, const char *format, ...) *ptr = NULL; va_start(ap, format); - vasprintf(ptr, format, ap); + if (vasprintf(ptr, format, ap) == -1) { + fatal("out of memory in x_asprintf"); + } va_end(ap); if (!ptr) fatal("out of memory in x_asprintf");