代码拉取完成,页面将自动刷新
同步操作将从 IvorySQL/IvorySQL 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*-------------------------------------------------------------------------
*
* user.c
*
* Wrapper functions for user and home directory lookup.
*
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
*
* src/port/user.c
*
*-------------------------------------------------------------------------
*/
#include "c.h"
#include <pwd.h>
#ifndef WIN32
/*
* pg_get_user_name - get the name of the user with the given ID
*
* On success, the user name is returned into the buffer (of size buflen),
* and "true" is returned. On failure, a localized error message is
* returned into the buffer, and "false" is returned.
*/
bool
pg_get_user_name(uid_t user_id, char *buffer, size_t buflen)
{
char pwdbuf[BUFSIZ];
struct passwd pwdstr;
struct passwd *pw = NULL;
int pwerr;
pwerr = getpwuid_r(user_id, &pwdstr, pwdbuf, sizeof(pwdbuf), &pw);
if (pw != NULL)
{
strlcpy(buffer, pw->pw_name, buflen);
return true;
}
if (pwerr != 0)
snprintf(buffer, buflen,
_("could not look up local user ID %d: %s"),
(int) user_id,
strerror_r(pwerr, pwdbuf, sizeof(pwdbuf)));
else
snprintf(buffer, buflen,
_("local user with ID %d does not exist"),
(int) user_id);
return false;
}
/*
* pg_get_user_home_dir - get the home directory of the user with the given ID
*
* On success, the directory path is returned into the buffer (of size buflen),
* and "true" is returned. On failure, a localized error message is
* returned into the buffer, and "false" is returned.
*
* Note that this does not incorporate the common behavior of checking
* $HOME first, since it's independent of which user_id is queried.
*/
bool
pg_get_user_home_dir(uid_t user_id, char *buffer, size_t buflen)
{
char pwdbuf[BUFSIZ];
struct passwd pwdstr;
struct passwd *pw = NULL;
int pwerr;
pwerr = getpwuid_r(user_id, &pwdstr, pwdbuf, sizeof(pwdbuf), &pw);
if (pw != NULL)
{
strlcpy(buffer, pw->pw_dir, buflen);
return true;
}
if (pwerr != 0)
snprintf(buffer, buflen,
_("could not look up local user ID %d: %s"),
(int) user_id,
strerror_r(pwerr, pwdbuf, sizeof(pwdbuf)));
else
snprintf(buffer, buflen,
_("local user with ID %d does not exist"),
(int) user_id);
return false;
}
#endif /* !WIN32 */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。