diff options
author | Tao Bao <tbao@google.com> | 2015-09-08 19:46:31 +0200 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-08 19:46:31 +0200 |
commit | e5571a0ff8217a6fe1b3defdb22295596e36c280 (patch) | |
tree | 5b579ea703f06a809578bec20ac82260ebc36bfd | |
parent | am f8c303f9: Merge "move uncrypt from init.rc to uncrypt.rc" (diff) | |
parent | Merge "imgdiff: fix file descriptor leak" (diff) | |
download | android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar.gz android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar.bz2 android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar.lz android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar.xz android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.tar.zst android_bootable_recovery-e5571a0ff8217a6fe1b3defdb22295596e36c280.zip |
Diffstat (limited to '')
-rw-r--r-- | applypatch/imgdiff.cpp | 10 |
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) { |