From: Andre Noll Date: Fri, 15 Jan 2010 19:11:50 +0000 (+0100) Subject: Fix creation of zero-sized disk storage objects. X-Git-Tag: v0.1.2~9 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=5ce943c5cee7b42a9feb6577c60efc68d6378003;p=osl.git Fix creation of zero-sized disk storage objects. We must not call write_all() with a zero length parameter. --- diff --git a/util.c b/util.c index 49f1914..572b7a5 100644 --- a/util.c +++ b/util.c @@ -110,9 +110,11 @@ int write_file(const char *filename, const void *buf, size_t size) if (ret < 0) return ret; fd = ret; - ret = write_all(fd, buf, &size); - if (ret < 0) - goto out; + if (size != 0) { + ret = write_all(fd, buf, &size); + if (ret < 0) + goto out; + } ret = 1; out: close(fd);