>From 60fd004576fced709ac351100f96afe10098aa73 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Tue, 1 Nov 2016 17:29:44 +0100 Subject: [PATCH 3/3] oldfind: fix compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid the following 2 warnings: oldfind.c: In function ‘main’: oldfind.c:228:5: warning: passing argument 1 of ‘ctime’ from incompatible pointer type [enabled by default] fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start/*.tv_sec*/)); ^ In file included from ../gl/lib/time.h:41:0, from ../gl/lib/sys/stat.h:44, from oldfind.c:35: /usr/include/time.h:264:14: note: expected ‘const time_t *’ but argument is of type ‘struct timespec *’ oldfind.c: In function ‘at_top’: oldfind.c:1003:12: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default] base = pathname; ^ * find/oldfind.c (main): Correct the call to ctime; it takes time_t*, so don't pass struct timeval*; instead, pass the address of the tv_sec member. (at_top): Declare base as const char*. --- find/oldfind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/find/oldfind.c b/find/oldfind.c index d2641aa..49e1796 100644 --- a/find/oldfind.c +++ b/find/oldfind.c @@ -225,7 +225,7 @@ main (int argc, char **argv) options.xstat = debug_stat; if (options.debug_options & DebugTime) - fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start)); + fprintf (stderr, "cur_day_start = %s", ctime (&options.cur_day_start.tv_sec)); /* state.cwd_dir_fd has to be initialized before we call build_expression_tree () * because command-line parsing may lead us to stat some files. @@ -991,7 +991,7 @@ at_top (const char *pathname, { int dirchange; char *parent_dir = dir_name (pathname); - char *base = last_component (pathname); + const char *base = last_component (pathname); state.curdepth = 0; state.starting_path_length = strlen (pathname); -- 2.1.4