diff options
author | Dees_Troy <dees_troy@teamw.in> | 2013-05-04 14:39:56 +0200 |
---|---|---|
committer | Dees_Troy <dees_troy@yahoo.com> | 2013-06-22 23:16:55 +0200 |
commit | 83bd483f3db1df4b69c1612030e1a1be05b303ad (patch) | |
tree | d5c7b468b831244bfcd90aadda98b9d359d0d280 /tarWrite.c | |
parent | Fix building of updater binary (diff) | |
download | android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar.gz android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar.bz2 android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar.lz android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar.xz android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.tar.zst android_bootable_recovery-83bd483f3db1df4b69c1612030e1a1be05b303ad.zip |
Diffstat (limited to '')
-rw-r--r-- | tarWrite.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tarWrite.c b/tarWrite.c index f5af4491b..7d46014bd 100644 --- a/tarWrite.c +++ b/tarWrite.c @@ -29,11 +29,13 @@ int flush = 0, eot_count = -1; unsigned char *write_buffer; unsigned buffer_size = 4096; unsigned buffer_loc = 0; +int buffer_status = 0; void reinit_libtar_buffer(void) { flush = 0; eot_count = -1; buffer_loc = 0; + buffer_status = 1; } void init_libtar_buffer(unsigned new_buff_size) { @@ -45,7 +47,9 @@ void init_libtar_buffer(unsigned new_buff_size) { } void free_libtar_buffer(void) { - free(write_buffer); + if (buffer_status > 0) + free(write_buffer); + buffer_status = 0; } ssize_t write_libtar_buffer(int fd, const void *buffer, size_t size) { @@ -89,4 +93,5 @@ ssize_t write_libtar_buffer(int fd, const void *buffer, size_t size) { void flush_libtar_buffer(int fd) { eot_count = 0; + buffer_status = 2; } |