mc/mc-getpwuid.patch

17 lines
426 B
Diff
Raw Normal View History

--- edit/editlock.c
+++ edit/editlock.c
@@ -69,9 +69,11 @@
lock_build_name (void)
{
char host[BUF_SIZE];
- const char *user;
+ const char *user = NULL;
+ struct passwd *pw;
- user = getpwuid (getuid ())->pw_name;
+ pw = getpwuid (getuid ());
+ if (pw) user = pw->pw_name;
if (!user) user = getenv ("USER");
if (!user) user = getenv ("USERNAME");
if (!user) user = getenv ("LOGNAME");