summaryrefslogtreecommitdiff
path: root/e2fsprogs/blkid/save.c
diff options
context:
space:
mode:
authorMike Frysinger2005-06-11 22:37:25 +0000
committerMike Frysinger2005-06-11 22:37:25 +0000
commit7fde8debc450c19927b82e3434fc5d6a6dd4d35d (patch)
treeec0c844948d2fd786039f5ba39427a82e004506d /e2fsprogs/blkid/save.c
parentd1a9d57bd6d9e40fb25564f10b0bd85f0a2c1e3a (diff)
downloadbusybox-7fde8debc450c19927b82e3434fc5d6a6dd4d35d.zip
busybox-7fde8debc450c19927b82e3434fc5d6a6dd4d35d.tar.gz
use malloc instead of xmalloc
Diffstat (limited to 'e2fsprogs/blkid/save.c')
-rw-r--r--e2fsprogs/blkid/save.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/e2fsprogs/blkid/save.c b/e2fsprogs/blkid/save.c
index a2fbd7b..1830e45 100644
--- a/e2fsprogs/blkid/save.c
+++ b/e2fsprogs/blkid/save.c
@@ -90,16 +90,14 @@ int blkid_flush_cache(blkid_cache cache)
* a temporary file then we open it directly.
*/
if (ret == 0 && S_ISREG(st.st_mode)) {
- tmp = malloc(strlen(filename) + 8);
- if (tmp) {
- sprintf(tmp, "%s-XXXXXX", filename);
- fd = mkstemp(tmp);
- if (fd >= 0) {
- file = fdopen(fd, "w");
- opened = tmp;
- }
- fchmod(fd, 0644);
+ tmp = xmalloc(strlen(filename) + 8);
+ sprintf(tmp, "%s-XXXXXX", filename);
+ fd = mkstemp(tmp);
+ if (fd >= 0) {
+ file = fdopen(fd, "w");
+ opened = tmp;
}
+ fchmod(fd, 0644);
}
if (!file) {
@@ -138,13 +136,11 @@ int blkid_flush_cache(blkid_cache cache)
} else {
char *backup;
- backup = malloc(strlen(filename) + 5);
- if (backup) {
- sprintf(backup, "%s.old", filename);
- unlink(backup);
- link(filename, backup);
- free(backup);
- }
+ backup = xmalloc(strlen(filename) + 5);
+ sprintf(backup, "%s.old", filename);
+ unlink(backup);
+ link(filename, backup);
+ free(backup);
rename(opened, filename);
DBG(DEBUG_SAVE,
printf("moved temp cache %s\n", opened));