[PATCH 01/11] last: include libgen.h for basename(3p)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 login-utils/last.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/login-utils/last.c b/login-utils/last.c
index 6d0e892..90eee68 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -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) {
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux