git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fallback on getpwuid if envar HOME is unset

From
COConley Owens <cco3@android.com>
Date
Aug 21, 2012, 01:28 UTC
Message-ID
<CAFFUb6WiXJ0n4NkhOQ=+mcfs+uaAo2_G6TOs7L=AuPwPVfxyMg@mail.gmail.com>
>From f64ba3c908b33a2ea5a5ad1f0e5800af76b82ce9 Mon Sep 17 00:00:00 2001
From: Conley Owens <cco3@android.com>
Date: Mon, 20 Aug 2012 18:23:40 -0700
Subject: [PATCH] Fallback on getpwuid if envar HOME is unset
Signed-off-by: Conley Owens <cco3@android.com>
---
 path.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/path.c b/path.c
index 66acd24..60affab 100644
--- a/path.c
+++ b/path.c
@@ -144,6 +144,11 @@ void home_config_paths(char **global, char **xdg,
char *file)
        char *to_free = NULL;

        if (!home) {
+         struct passwd *pw = xgetpwuid_self();
+         home = pw->pw_dir;
+       }
+
+       if (!home) {
                if (global)
                        *global = NULL;
        } else {
-- 
1.7.11-rc3
Next: Jeff King
Message 1 of 9 in “Fallback on getpwuid if envar HOME is unset”
  1. Fallback on getpwuid if envar HOME is unsetConley Owens, Aug 21, 2012
  2. Jeff KingAug 21, 2012
  3. Conley OwensAug 21, 2012
  4. Junio C HamanoAug 21, 2012
  5. Conley OwensAug 21, 2012
  6. Junio C HamanoAug 21, 2012
  7. Jeff KingAug 21, 2012
  8. Andreas SchwabAug 21, 2012
  9. Junio C HamanoAug 21, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.