]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix GCC 4.3 warnings
authorWilliam S Fulton <wsf@fultondesigns.co.uk>
Sun, 1 Nov 2009 18:39:58 +0000 (19:39 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 5 Jan 2010 17:53:00 +0000 (18:53 +0100)
See <http://bugs.debian.org/508046>.

ccache.c
stats.c
util.c

index e2552163f685907cbd32a90c32f03a5a35054a56..c5805df4ec65268fd15d706999da6393a42d3074 100644 (file)
--- 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 ddaf768db3b1f044b5a496693f10a050a9d67e22..593cd1532394e74fb4fe1c4fdbf9bae4705d9122 100644 (file)
--- 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 4c54efb8df0b05d3026c4ceddfaf841291f4f17e..fc5a4c7a2faaa8e8e98c3aa860aae219919e4fe1 100644 (file)
--- 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");