Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-12-11 00:33:05 +0300
committerJunio C Hamano <gitster@pobox.com>2015-12-11 02:38:59 +0300
commite850194c83985396435b01b70d2db00b6d3af02e (patch)
treea13a88de4799865914dd7798306af1716472d376 /ident.c
parentbc497127894ab6ad955d474c72836c03282e6c6f (diff)
ident: make xgetpwuid_self() a static local helper
This function is defined in wrapper.c, but nobody besides ident.c uses it. And nobody is likely to in the future, either, as anything that cares about the user's name should be going through the ident code. Moving it here is a cleanup of the global namespace, but it will also enable further cleanups inside ident.c. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ident.c b/ident.c
index 5ff1aadaaa..d7c70e28d2 100644
--- a/ident.c
+++ b/ident.c
@@ -23,6 +23,18 @@ static int author_ident_explicitly_given;
#define get_gecos(struct_passwd) ((struct_passwd)->pw_gecos)
#endif
+static struct passwd *xgetpwuid_self(void)
+{
+ struct passwd *pw;
+
+ errno = 0;
+ pw = getpwuid(getuid());
+ if (!pw)
+ die(_("unable to look up current user in the passwd file: %s"),
+ errno ? strerror(errno) : _("no such user"));
+ return pw;
+}
+
static void copy_gecos(const struct passwd *w, struct strbuf *name)
{
char *src;