Removed
Link Here
|
1 |
--- glib/glib-unix.c.orig 2021-09-17 10:17:56 UTC |
2 |
+++ glib/glib-unix.c |
3 |
@@ -463,7 +463,6 @@ g_unix_get_passwd_entry (const gchar *user_name, |
4 |
} *buffer = NULL; |
5 |
gsize string_buffer_size = 0; |
6 |
GError *local_error = NULL; |
7 |
- int errsv = 0; |
8 |
|
9 |
g_return_val_if_fail (user_name != NULL, NULL); |
10 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
11 |
@@ -493,10 +492,8 @@ g_unix_get_passwd_entry (const gchar *user_name, |
12 |
*/ |
13 |
buffer = g_malloc0 (sizeof (*buffer) + string_buffer_size + 6); |
14 |
|
15 |
- errno = 0; |
16 |
retval = getpwnam_r (user_name, &buffer->pwd, buffer->string_buffer, |
17 |
string_buffer_size, &passwd_file_entry); |
18 |
- errsv = errno; |
19 |
|
20 |
/* Bail out if: the lookup was successful, or if the user id can't be |
21 |
* found (should be pretty rare case actually), or if the buffer should be |
22 |
@@ -508,19 +505,19 @@ g_unix_get_passwd_entry (const gchar *user_name, |
23 |
break; |
24 |
} |
25 |
else if (retval == 0 || |
26 |
- errsv == ENOENT || errsv == ESRCH || |
27 |
- errsv == EBADF || errsv == EPERM) |
28 |
+ retval == ENOENT || retval == ESRCH || |
29 |
+ retval == EBADF || retval == EPERM) |
30 |
{ |
31 |
/* Username not found. */ |
32 |
- g_unix_set_error_from_errno (&local_error, errsv); |
33 |
+ g_unix_set_error_from_errno (&local_error, retval); |
34 |
break; |
35 |
} |
36 |
- else if (errsv == ERANGE) |
37 |
+ else if (retval == ERANGE) |
38 |
{ |
39 |
/* Can’t allocate enough string buffer space. */ |
40 |
if (string_buffer_size > 32 * 1024) |
41 |
{ |
42 |
- g_unix_set_error_from_errno (&local_error, errsv); |
43 |
+ g_unix_set_error_from_errno (&local_error, retval); |
44 |
break; |
45 |
} |
46 |
|
47 |
@@ -529,7 +526,7 @@ g_unix_get_passwd_entry (const gchar *user_name, |
48 |
} |
49 |
else |
50 |
{ |
51 |
- g_unix_set_error_from_errno (&local_error, errsv); |
52 |
+ g_unix_set_error_from_errno (&local_error, retval); |
53 |
break; |
54 |
} |
55 |
} |
56 |
@@ -543,7 +540,6 @@ g_unix_get_passwd_entry (const gchar *user_name, |
57 |
{ |
58 |
g_clear_pointer (&buffer, g_free); |
59 |
g_propagate_error (error, g_steal_pointer (&local_error)); |
60 |
- errno = errsv; |
61 |
} |
62 |
|
63 |
return (struct passwd *) g_steal_pointer (&buffer); |