From ce4081af934e37876f3b6e641935364b4d8bbfaf Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 31 May 2014 13:46:28 -0700 Subject: [PATCH] Fix some warnings in Linux build --- builtin_test.cpp | 4 ---- wutil.cpp | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin_test.cpp b/builtin_test.cpp index 0d16823af..233696284 100644 --- a/builtin_test.cpp +++ b/builtin_test.cpp @@ -646,13 +646,11 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err) expression *result = parser.parse_expression(0, (unsigned int)args.size()); /* Handle errors */ - bool errored = false; for (size_t i = 0; i < parser.errors.size(); i++) { err.append(L"test: "); err.append(parser.errors.at(i)); err.push_back(L'\n'); - errored = true; // For now we only show the first error break; } @@ -667,14 +665,12 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err) { append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str()); } - errored = true; delete result; result = NULL; } } - return result; } diff --git a/wutil.cpp b/wutil.cpp index 3b1bba793..d8fe82f7a 100644 --- a/wutil.cpp +++ b/wutil.cpp @@ -35,7 +35,7 @@ typedef std::string cstring; -const file_id_t kInvalidFileID = {-1, -1, -1, -1, -1, -1}; +const file_id_t kInvalidFileID = {(dev_t)-1LL, (ino_t)-1LL, (uint64_t)-1LL, -1, -1, (uint32_t)-1}; /** Minimum length of the internal covnersion buffers @@ -319,6 +319,10 @@ static inline void safe_append(char *buffer, const char *s, size_t buffsize) strncat(buffer, s, buffsize - strlen(buffer) - 1); } +// In general, strerror is not async-safe, and therefore we cannot use it directly +// So instead we have to grub through sys_nerr and sys_errlist directly +// On GNU toolchain, this will produce a deprecation warning from the linker (!!), +// which appears impossible to suppress! const char *safe_strerror(int err) { #if defined(__UCLIBC__)