Skip to content
Snippets Groups Projects
Commit 758ee814 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

fix errno

parent f07d94c8
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,8 @@ char const *get_userhome(uid_t myuid) ...@@ -22,7 +22,8 @@ char const *get_userhome(uid_t myuid)
{ {
char const *user_home = NULL ; char const *user_home = NULL ;
struct passwd *st = getpwuid(myuid) ; struct passwd *st = getpwuid(myuid) ;
int e = errno ;
errno = 0 ;
if (!st) if (!st)
{ {
if (!errno) errno = ESRCH ; if (!errno) errno = ESRCH ;
...@@ -31,6 +32,6 @@ char const *get_userhome(uid_t myuid) ...@@ -31,6 +32,6 @@ char const *get_userhome(uid_t myuid)
user_home = st->pw_dir ; user_home = st->pw_dir ;
if (!user_home) return 0 ; if (!user_home) return 0 ;
errno = e ;
return user_home ; return user_home ;
} }
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
int set_ownerhome(stralloc *base,uid_t owner) int set_ownerhome(stralloc *base,uid_t owner)
{ {
char const *user_home = NULL ; char const *user_home = 0 ;
int e = errno ; int e = errno ;
struct passwd *st = getpwuid(owner) ; struct passwd *st = getpwuid(owner) ;
errno = 0 ;
if (!st) if (!st)
{ {
if (!errno) errno = ESRCH ; if (!errno) errno = ESRCH ;
......
...@@ -29,7 +29,7 @@ int set_ownersysdir(stralloc *base, uid_t owner) ...@@ -29,7 +29,7 @@ int set_ownersysdir(stralloc *base, uid_t owner)
char const *user_home = NULL ; char const *user_home = NULL ;
int e = errno ; int e = errno ;
struct passwd *st = getpwuid(owner) ; struct passwd *st = getpwuid(owner) ;
errno = 0 ;
if (!st) if (!st)
{ {
if (!errno) errno = ESRCH ; if (!errno) errno = ESRCH ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment