am 36d44740: Merge "Fix a bunch of small system/core bugs."
* commit '36d44740dd045403ae615b8dd6dac8b9a4e9f5bf': Fix a bunch of small system/core bugs.
This commit is contained in:
commit
f17f55914e
9 changed files with 17 additions and 4 deletions
|
|
@ -642,8 +642,8 @@ static int local_build_list(copyinfo **filelist,
|
||||||
ci = mkcopyinfo(lpath, rpath, name, 0);
|
ci = mkcopyinfo(lpath, rpath, name, 0);
|
||||||
if(lstat(ci->src, &st)) {
|
if(lstat(ci->src, &st)) {
|
||||||
fprintf(stderr,"cannot stat '%s': %s\n", ci->src, strerror(errno));
|
fprintf(stderr,"cannot stat '%s': %s\n", ci->src, strerror(errno));
|
||||||
|
free(ci);
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) {
|
if(!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) {
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ static int do_list(int s, const char *path)
|
||||||
|
|
||||||
if(writex(s, &msg.dent, sizeof(msg.dent)) ||
|
if(writex(s, &msg.dent, sizeof(msg.dent)) ||
|
||||||
writex(s, de->d_name, len)) {
|
writex(s, de->d_name, len)) {
|
||||||
|
closedir(d);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,8 @@ static void _archive_dir(char *in, char *out, int ilen, int olen)
|
||||||
free(names[i]);
|
free(names[i]);
|
||||||
}
|
}
|
||||||
free(names);
|
free(names);
|
||||||
|
|
||||||
|
closedir(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _archive(char *in, char *out, int ilen, int olen)
|
static void _archive(char *in, char *out, int ilen, int olen)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
|
||||||
LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c
|
LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c
|
||||||
LOCAL_MODULE := fastboot
|
LOCAL_MODULE := fastboot
|
||||||
LOCAL_MODULE_TAGS := debug
|
LOCAL_MODULE_TAGS := debug
|
||||||
|
LOCAL_CFLAGS += -std=gnu99
|
||||||
|
|
||||||
ifeq ($(HOST_OS),linux)
|
ifeq ($(HOST_OS),linux)
|
||||||
LOCAL_SRC_FILES += usb_linux.c util_linux.c
|
LOCAL_SRC_FILES += usb_linux.c util_linux.c
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,13 @@ static int setup_requirement_line(char *name)
|
||||||
|
|
||||||
for(n = 0; n < count; n++) {
|
for(n = 0; n < count; n++) {
|
||||||
out[n] = strdup(strip(val[n]));
|
out[n] = strdup(strip(val[n]));
|
||||||
if (out[n] == 0) return -1;
|
if (out[n] == 0) {
|
||||||
|
for(size_t i = 0; i < n; ++i) {
|
||||||
|
free((char*) out[i]);
|
||||||
|
}
|
||||||
|
free(out);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_queue_require(prod, name, invert, n, out);
|
fb_queue_require(prod, name, invert, n, out);
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ void show(struct ptable *ptbl)
|
||||||
{
|
{
|
||||||
struct efi_entry *entry = ptbl->entry;
|
struct efi_entry *entry = ptbl->entry;
|
||||||
unsigned n, m;
|
unsigned n, m;
|
||||||
char name[EFI_NAMELEN];
|
char name[EFI_NAMELEN + 1];
|
||||||
|
|
||||||
fprintf(stderr,"ptn start block end block name\n");
|
fprintf(stderr,"ptn start block end block name\n");
|
||||||
fprintf(stderr,"---- ------------- ------------- --------------------\n");
|
fprintf(stderr,"---- ------------- ------------- --------------------\n");
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ static int recurse(HashAlgorithm algorithm, const char *directory_path,
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
free(node);
|
free(node);
|
||||||
|
closedir(d);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ int backed_block_split(struct backed_block_list *bbl, struct backed_block *bb,
|
||||||
}
|
}
|
||||||
|
|
||||||
new_bb = malloc(sizeof(struct backed_block));
|
new_bb = malloc(sizeof(struct backed_block));
|
||||||
if (bb == NULL) {
|
if (new_bb == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -722,10 +722,12 @@ int write_fd_chunk(struct output_file *out, unsigned int len,
|
||||||
}
|
}
|
||||||
pos = lseek64(fd, offset, SEEK_SET);
|
pos = lseek64(fd, offset, SEEK_SET);
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
|
free(data);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
ret = read_all(fd, data, len);
|
ret = read_all(fd, data, len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
free(data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ptr = data;
|
ptr = data;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue