From 12f61e09d943ea7fc4149166077507b5b0b3b4e7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 12 Sep 2007 21:48:20 +0000 Subject: r25117: The mega-patch Jerry was waiting for. Remove all pstrings from the main server code paths. We should now be able to cope with paths up to PATH_MAX length now. Final job will be to add the TALLOC_CTX * parameter to unix_convert to make it explicit (for Volker). Jeremy. (This used to be commit 7f0db75fb0f24873577dcb758a2ecee74fdc4297) --- source3/lib/util.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 5314239e07..2d34371ab3 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1578,20 +1578,22 @@ BOOL process_exists_by_pid(pid_t pid) const char *uidtoname(uid_t uid) { - fstring name; - struct passwd *pass; + TALLOC_CTX *ctx = talloc_tos(); + char *name = NULL; + struct passwd *pass = NULL; - pass = getpwuid_alloc(talloc_tos(), uid); + pass = getpwuid_alloc(ctx,uid); if (pass) { - fstrcpy(name, pass->pw_name); + name = talloc_strdup(ctx,pass->pw_name); TALLOC_FREE(pass); } else { - slprintf(name, sizeof(name) - 1, "%ld",(long int)uid); + name = talloc_asprintf(ctx, + "%ld", + (long int)uid); } - return talloc_strdup(talloc_tos(), name); + return name; } - /******************************************************************* Convert a gid into a group name. ********************************************************************/ -- cgit