summaryrefslogtreecommitdiffstats
path: root/applypatch/imgdiff.cpp
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2015-09-08 19:15:09 +0200
committerJeremy Compostella <jeremy.compostella@intel.com>2015-09-08 19:15:09 +0200
commita91c66d7c13e0143f63f0ea9c1c74ce39aecd79e (patch)
tree1b1288f70cf8c534a2c171f39037cf5607480b25 /applypatch/imgdiff.cpp
parentMerge "move uncrypt from init.rc to uncrypt.rc" (diff)
downloadandroid_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar.gz
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar.bz2
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar.lz
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar.xz
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.tar.zst
android_bootable_recovery-a91c66d7c13e0143f63f0ea9c1c74ce39aecd79e.zip
Diffstat (limited to 'applypatch/imgdiff.cpp')
-rw-r--r--applypatch/imgdiff.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index 4d83ffb2e..50cabbe6b 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -628,7 +628,15 @@ unsigned char* MakePatch(ImageChunk* src, ImageChunk* tgt, size_t* size) {
}
char ptemp[] = "/tmp/imgdiff-patch-XXXXXX";
- mkstemp(ptemp);
+ int fd = mkstemp(ptemp);
+
+ if (fd == -1) {
+ printf("MakePatch failed to create a temporary file: %s\n",
+ strerror(errno));
+ return NULL;
+ }
+ close(fd); // temporary file is created and we don't need its file
+ // descriptor
int r = bsdiff(src->data, src->len, &(src->I), tgt->data, tgt->len, ptemp);
if (r != 0) {