diff options
Diffstat (limited to 'CCache')
-rw-r--r-- | CCache/ccache.c | 4 | ||||
-rw-r--r-- | CCache/stats.c | 2 | ||||
-rw-r--r-- | 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"); |