]> code.ossystems Code Review - openembedded-core.git/blob
c7006ef6df386b4db0294cfd7307b94799dc4c32
[openembedded-core.git] /
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
5
6 * Make the search directory pointers const: there is no reason why this
7   function should be allowed to mutate the directories.
8
9 * Change the search directory argument from an array of pointers to a
10   pointer-to-pointers to prepare for an upcoming enhancement.
11
12 Upstream-Status: Pending
13 Signed-off-by: Peter A. Bigot <pab@pabigot.com>
14 ---
15  pseudo.h        | 2 +-
16  pseudo_client.c | 2 +-
17  pseudo_util.c   | 4 ++--
18  3 files changed, 4 insertions(+), 4 deletions(-)
19
20 diff --git a/pseudo.h b/pseudo.h
21 index 92020e4..05813c1 100644
22 --- a/pseudo.h
23 +++ b/pseudo.h
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 *);
32  
33 diff --git a/pseudo_client.c b/pseudo_client.c
34 index 442dd19..7a4d7fa 100644
35 --- a/pseudo_client.c
36 +++ b/pseudo_client.c
37 @@ -93,7 +93,7 @@ gid_t pseudo_egid;
38  gid_t pseudo_sgid;
39  gid_t pseudo_fgid;
40  
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)
43  
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
48 --- a/pseudo_util.c
49 +++ b/pseudo_util.c
50 @@ -1264,7 +1264,7 @@ FILE *pseudo_host_etc_group_file = &pseudo_fake_group_file;
51  #endif
52  
53  int
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()];
57         int rc = -1;
58  
59 @@ -1280,7 +1280,7 @@ pseudo_etc_file(const char *file, char *realname, int flags, char *search_dirs[]
60                 return -1;
61         }
62         for (i = 0; i < dircount; ++i) {
63 -               char *s = search_dirs[i];
64 +               const char *s = search_dirs[i];
65                 if (!s)
66                         continue;
67  #if PSEUDO_PORT_DARWIN
68 -- 
69 1.8.5.5
70