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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * 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. * This file is part of GNU Mes.
* *
@ -23,12 +23,13 @@
#include <pwd.h> #include <pwd.h>
struct passwd * struct passwd *
getpwnam (const char *NAME) getpwnam (const char *name)
{ {
static int stub = 0; static int stub = 0;
if (__mes_debug () && !stub) if (__mes_debug () && !stub)
eputs ("getpwnam stub\n"); eputs ("getpwnam stub\n");
stub = 1; stub = 1;
errno = 0; 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:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * 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. * This file is part of GNU Mes.
* *
@ -30,5 +30,6 @@ getpwuid (uid_t uid)
eputs ("getpwuid stub\n"); eputs ("getpwuid stub\n");
stub = 1; stub = 1;
errno = 0; errno = 0;
return 0; static struct passwd root = { "root", "*", 0, 0, "", "/root", "/bin/sh" };
return &root;
} }