1 From f05def2bbd5507084672bc9072ffe0e5101e9b47 Mon Sep 17 00:00:00 2001
2 From: "Peter A. Bigot" <pab@pabigot.com>
3 Date: Sun, 12 Oct 2014 11:35:57 -0500
4 Subject: [PATCH 2/3] pseudo_util: modify interface to pseudo_etc_file
6 * Make the search directory pointers const: there is no reason why this
7 function should be allowed to mutate the directories.
9 * Change the search directory argument from an array of pointers to a
10 pointer-to-pointers to prepare for an upcoming enhancement.
12 Upstream-Status: Pending
13 Signed-off-by: Peter A. Bigot <pab@pabigot.com>
16 pseudo_client.c | 2 +-
17 pseudo_util.c | 4 ++--
18 3 files changed, 4 insertions(+), 4 deletions(-)
20 diff --git a/pseudo.h b/pseudo.h
21 index 92020e4..05813c1 100644
24 @@ -86,7 +86,7 @@ extern int pseudo_logfile(char *defname);
25 extern ssize_t pseudo_sys_path_max(void);
26 extern ssize_t pseudo_path_max(void);
27 #define PSEUDO_PWD_MAX 4096
28 -extern int pseudo_etc_file(const char *filename, char *realname, int flags, char *path[], int dircount);
29 +extern int pseudo_etc_file(const char *filename, char *realname, int flags, const char **search_dirs, int dircount);
30 extern void pseudo_stat32_from64(struct stat *, const struct stat64 *);
31 extern void pseudo_stat64_from32(struct stat64 *, const struct stat *);
33 diff --git a/pseudo_client.c b/pseudo_client.c
34 index 442dd19..7a4d7fa 100644
37 @@ -93,7 +93,7 @@ gid_t pseudo_egid;
41 -#define PSEUDO_ETC_FILE(filename, realname, flags) pseudo_etc_file(filename, realname, flags, (char *[]) { pseudo_chroot, pseudo_passwd, PSEUDO_PASSWD_FALLBACK }, PSEUDO_PASSWD_FALLBACK ? 3 : 2)
42 +#define PSEUDO_ETC_FILE(filename, realname, flags) pseudo_etc_file(filename, realname, flags, (const char *[]) { pseudo_chroot, pseudo_passwd, PSEUDO_PASSWD_FALLBACK }, PSEUDO_PASSWD_FALLBACK ? 3 : 2)
44 /* helper function to make a directory, just like mkdir -p.
45 * Can't use system() because the child shell would end up trying
46 diff --git a/pseudo_util.c b/pseudo_util.c
47 index e4e1fc8..647d3ad 100644
50 @@ -1264,7 +1264,7 @@ FILE *pseudo_host_etc_group_file = &pseudo_fake_group_file;
54 -pseudo_etc_file(const char *file, char *realname, int flags, char *search_dirs[], int dircount) {
55 +pseudo_etc_file(const char *file, char *realname, int flags, const char **search_dirs, int dircount) {
56 char filename[pseudo_path_max()];
59 @@ -1280,7 +1280,7 @@ pseudo_etc_file(const char *file, char *realname, int flags, char *search_dirs[]
62 for (i = 0; i < dircount; ++i) {
63 - char *s = search_dirs[i];
64 + const char *s = search_dirs[i];
67 #if PSEUDO_PORT_DARWIN