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.
This commit is contained in:
Jan Nieuwenhuizen 2019-07-31 12:25:43 +02:00
parent 5c979a8ce1
commit de197a48f5
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -23,12 +23,13 @@
#include <pwd.h>
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;
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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;
}