From ab6028e5bd20a6b3c89d84caa879576c9b3082fd Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 5 Jan 2019 11:25:43 +0100 Subject: [PATCH] mescc: Mes C Library: Support GNU Tar: Fix getpwnam, getpwuid stubs. * lib/stub/getpwnam.c (getpwnam): Return pointer to static struct passwd. * lib/stub/getpwuid.c (getpwuid): Likewise. --- lib/stub/getpwnam.c | 7 ++++--- lib/stub/getpwuid.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/stub/getpwnam.c b/lib/stub/getpwnam.c index 472b42aa..0c2e9383 100644 --- a/lib/stub/getpwnam.c +++ b/lib/stub/getpwnam.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,12 +22,13 @@ #include struct passwd * -getpwnam (const char *NAME) +getpwnam (const char *name) { static int stub = 0; if (__mes_debug () && !stub) eputs ("getpwnam stub\n"); stub = 1; errno = 0; - return 0; + static struct passwd root = {"root", "*", 0, 0, "", "/root", "/bin/sh"}; + return &root; } diff --git a/lib/stub/getpwuid.c b/lib/stub/getpwuid.c index 647fd54e..62b1d578 100644 --- a/lib/stub/getpwuid.c +++ b/lib/stub/getpwuid.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -29,5 +29,6 @@ getpwuid () eputs ("getpwuid stub\n"); stub = 1; errno = 0; - return 0; + static struct passwd root = {"root", "*", 0, 0, "", "/root", "/bin/sh"}; + return &root; }