Personally I'd have made xstrdup take const char* like strdup(3), but I'm assuming that patch would be rejected... --- lib/lib.c | 6 ++++-- toys/android/getprop.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-)
From cc0cf45d1a824460f0ae38d14820593920761a4c Mon Sep 17 00:00:00 2001 From: Elliott Hughes <e...@google.com> Date: Fri, 3 Feb 2017 16:15:56 -0800 Subject: [PATCH] Silence a couple of warnings.
Personally I'd have made xstrdup take const char* like strdup(3), but I'm assuming that patch would be rejected... --- lib/lib.c | 6 ++++-- toys/android/getprop.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/lib.c b/lib/lib.c index c20a06c..8131b7c 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -646,8 +646,10 @@ int copy_tempfile(int fdin, char *name, char **tempname) fchmod(fd, statbuf.st_mode); // It's fine if this fails (generally because we're not root), but gcc no - // longer lets a (void) typecast silence the "unused result" warning, so... - if (fchown(fd, statbuf.st_uid, statbuf.st_gid)); + // longer lets a (void) typecast silence the "unused result" warning, and + // clang requires the ; be on a new line for obviousness, so... + if (fchown(fd, statbuf.st_uid, statbuf.st_gid)) + ; return fd; } diff --git a/toys/android/getprop.c b/toys/android/getprop.c index 51e7344..eede937 100644 --- a/toys/android/getprop.c +++ b/toys/android/getprop.c @@ -29,7 +29,7 @@ GLOBALS( struct selabel_handle *handle; ) -static char *get_property_context(char *property) +static char *get_property_context(const char *property) { char *context = NULL; @@ -43,11 +43,11 @@ static void read_callback(void *unused, const char *name, const char *value) { if (!(TT.size&31)) TT.nv = xrealloc(TT.nv, (TT.size+32)*2*sizeof(char *)); - TT.nv[2*TT.size] = xstrdup(name); + TT.nv[2*TT.size] = xstrdup((char *)name); if (toys.optflags & FLAG_Z) { TT.nv[1+2*TT.size++] = get_property_context(name); } else { - TT.nv[1+2*TT.size++] = xstrdup(value); + TT.nv[1+2*TT.size++] = xstrdup((char *)value); } } -- 2.11.0.483.g087da7b7c-goog
_______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net