1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

mysqld won't give a warning any more, if --user=user_name is used,

if 'user_name' is the current user and it is not root.
This commit is contained in:
jani@ua126d19.elisa.omakaista.fi
2003-06-05 16:56:38 +03:00
parent 4851b571bb
commit 058d8ed14b

View File

@@ -1013,14 +1013,21 @@ static void set_ports()
static void set_user(const char *user)
{
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
struct passwd *ent;
struct passwd *ent;
uid_t user_id= geteuid();
// don't bother if we aren't superuser
if (geteuid())
if (user_id)
{
if (user)
fprintf(stderr,
"Warning: One can only use the --user switch if running as root\n");
{
/* Don't give a warning, if real user is same as given with --user */
struct passwd *user_info= getpwnam(user);
if (!user_info || user_id != user_info->pw_uid)
fprintf(stderr,
"Warning: One can only use the --user switch if running as root\n");
}
return;
}
else if (!user)