From: William S Fulton Date: Sun, 1 Nov 2009 18:39:58 +0000 (+0100) Subject: Fix GCC 4.3 warnings X-Git-Tag: v3.0pre0~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3259ac1e5cb44ffb30e00c8845d985217ec89df0;p=thirdparty%2Fccache.git Fix GCC 4.3 warnings See . --- diff --git a/ccache.c b/ccache.c index e2552163f..c5805df4e 100644 --- a/ccache.c +++ b/ccache.c @@ -144,7 +144,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/stats.c b/stats.c index ddaf768db..593cd1532 100644 --- a/stats.c +++ b/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/util.c b/util.c index 4c54efb8d..fc5a4c7a2 100644 --- a/util.c +++ b/util.c @@ -372,7 +372,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");