don't set errno or return an error when getspnam[_r] finds no entry
[musl] / src / legacy / getusershell.c
index 683158c..5fecdec 100644 (file)
@@ -1,7 +1,6 @@
 #define _GNU_SOURCE
 #include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
+#include <unistd.h>
 
 static const char defshells[] = "/bin/sh\n/bin/csh\n";
 
@@ -17,7 +16,7 @@ void endusershell(void)
 
 void setusershell(void)
 {
-       if (!f) f = fopen("/etc/shells", "rb");
+       if (!f) f = fopen("/etc/shells", "rbe");
        if (!f) f = fmemopen((void *)defshells, sizeof defshells - 1, "rb");
 }