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-01-05 11:25:43 +01:00
parent e81e48c701
commit 4d6084b20b
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.
*
@ -22,12 +22,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.
*
@ -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;
}