1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-06-09 19:26:51 +00:00

getpwuid() errno

This commit is contained in:
Gerhard 2025-02-10 19:42:22 +01:00
parent 7b26406d96
commit 264b21c1a9
2 changed files with 9 additions and 2 deletions

View file

@ -78,6 +78,9 @@ Corrections:
DCCP_CONNECT_MAXCHILDREN OPENSSL_CONNECT_MAXCHILDREN
SOCKS4_MAXCHILDREN SOCKS5_CONNECT_MAXCHILDREN PROXY_CONNECT_MAXCHILDREN
On failure of getpwuid() (used in options su and su-d) now consider
errno.
Features:
POSIXMQ-RECV now takes option o-nonblock; this, in combination with -T,
makes it possible to terminate Socat in case the queue is empty.

View file

@ -3944,8 +3944,12 @@ int applyopt_spec(
{
struct passwd *pwd;
if ((pwd = getpwuid(opt->value.u_uidt)) == NULL) {
Error1("getpwuid("F_uid"): no such user",
opt->value.u_uidt);
if (errno != 0)
Error2("getpwuid("F_uid"): %s",
opt->value.u_uidt, strerror(errno));
else
Error1("getpwuid("F_uid"): no such user",
opt->value.u_uidt);
return -1;
}
if (Initgroups(pwd->pw_name, pwd->pw_gid) < 0) {