]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: include libgen.h for basename(3p)
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 1 Dec 2016 08:52:04 +0000 (09:52 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Dec 2016 11:35:24 +0000 (12:35 +0100)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
login-utils/last.c

index 6d0e8920a6381467749573c5346ca453a0aad1fc..90eee68e5ec18e1d69a8c0821b561575d79475a5 100644 (file)
@@ -40,6 +40,7 @@
 #include <netinet/in.h>
 #include <netdb.h>
 #include <arpa/inet.h>
+#include <libgen.h>
 
 #include "c.h"
 #include "nls.h"
@@ -877,7 +878,11 @@ static void process_wtmp_file(const struct last_control *ctl,
                }
        }
 
-       printf(_("\n%s begins %s"), basename(filename), ctime(&begintime));
+       {
+               char* tmp = xstrdup(filename);
+               printf(_("\n%s begins %s"), basename(tmp), ctime(&begintime));
+               free(tmp);
+       }
        fclose(fp);
 
        for (p = ulist; p; p = next) {