Merge changes I8c6b2d1d,I06e0f759,I95d79809
am: cb8ed207d2
Change-Id: I0b0a272d704788d3f21a0365e34f6b09a792529b
This commit is contained in:
commit
06ec50f087
5 changed files with 15 additions and 7 deletions
|
@ -424,13 +424,18 @@ int async_safe_format_buffer(char* buffer, size_t buffer_size, const char* forma
|
|||
return buffer_len;
|
||||
}
|
||||
|
||||
int async_safe_format_fd(int fd, const char* format, ...) {
|
||||
int async_safe_format_fd_va_list(int fd, const char* format, va_list args) {
|
||||
FdOutputStream os(fd);
|
||||
out_vformat(os, format, args);
|
||||
return os.total;
|
||||
}
|
||||
|
||||
int async_safe_format_fd(int fd, const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
out_vformat(os, format, args);
|
||||
int result = async_safe_format_fd_va_list(fd, format, args);
|
||||
va_end(args);
|
||||
return os.total;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int write_stderr(const char* tag, const char* msg) {
|
||||
|
|
|
@ -90,6 +90,7 @@ int async_safe_format_buffer(char* buf, size_t size, const char* fmt, ...) __pri
|
|||
int async_safe_format_buffer_va_list(char* buffer, size_t buffer_size, const char* format, va_list args);
|
||||
|
||||
int async_safe_format_fd(int fd, const char* format , ...) __printflike(2, 3);
|
||||
int async_safe_format_fd_va_list(int fd, const char* format, va_list args);
|
||||
int async_safe_format_log(int pri, const char* tag, const char* fmt, ...) __printflike(3, 4);
|
||||
int async_safe_format_log_va_list(int pri, const char* tag, const char* fmt, va_list ap);
|
||||
int async_safe_write_log(int pri, const char* tag, const char* msg);
|
||||
|
|
|
@ -918,8 +918,7 @@ bool ZipArchiveCache::get_or_open(const char* zip_path, ZipArchiveHandle* handle
|
|||
|
||||
if (OpenArchiveFd(fd, "", handle) != 0) {
|
||||
// invalid zip-file (?)
|
||||
CloseArchive(handle);
|
||||
close(fd);
|
||||
CloseArchive(*handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ bool normalize_path(const char* path, std::string* normalized_path) {
|
|||
while (out_ptr > buf && *--out_ptr != '/') {
|
||||
}
|
||||
if (in_ptr[0] == 0) {
|
||||
// retain '/'
|
||||
out_ptr++;
|
||||
// retain '/' (or write the initial '/' for "/..")
|
||||
*out_ptr++ = '/';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ TEST(linker_utils, normalize_path_smoke) {
|
|||
ASSERT_TRUE(normalize_path("/a/../../b", &output));
|
||||
ASSERT_EQ("/b", output);
|
||||
|
||||
ASSERT_TRUE(normalize_path("/..", &output));
|
||||
ASSERT_EQ("/", output);
|
||||
|
||||
output = "unchanged";
|
||||
ASSERT_FALSE(normalize_path("root///dir/.///dir2/somedir/../zipfile!/dir/dir9//..///afile", &output));
|
||||
ASSERT_EQ("unchanged", output);
|
||||
|
|
Loading…
Reference in a new issue