From ff441b38e4fab7220e749a99c3a9e47325f2ef14 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 2820251d..fc82c916 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. * @@ -23,12 +23,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 aa1b8617..b8bdea02 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. * @@ -30,5 +30,6 @@ getpwuid (uid_t uid) eputs ("getpwuid stub\n"); stub = 1; errno = 0; - return 0; + static struct passwd root = { "root", "*", 0, 0, "", "/root", "/bin/sh" }; + return &root; }