projects
/
osl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
717ba6b
)
Fix creation of zero-sized disk storage objects.
author
Andre Noll
<maan@systemlinux.org>
Fri, 15 Jan 2010 19:11:50 +0000
(20:11 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Fri, 15 Jan 2010 19:11:50 +0000
(20:11 +0100)
We must not call write_all() with a zero length parameter.
util.c
patch
|
blob
|
history
diff --git
a/util.c
b/util.c
index 49f1914e81e59a2648a9cb9af364ad1d98ac58cd..572b7a52a4829489c84b1f9d94ead3dab910ae60 100644
(file)
--- 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);