aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_util.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-01-14 17:30:03 -0600
committerPeter Seebach <peter.seebach@windriver.com>2015-01-14 17:34:41 -0600
commit09238273dacb81bbc92c7d42986ef4e5fadf4a86 (patch)
tree3baeaeb38ccda8fdefc9fe1e37d1750b4659bff0 /pseudo_util.c
parent364c4a055477705a5370f59b9260226bb262a6db (diff)
downloadpseudo-09238273dacb81bbc92c7d42986ef4e5fadf4a86.tar.gz
pseudo-09238273dacb81bbc92c7d42986ef4e5fadf4a86.tar.bz2
pseudo-09238273dacb81bbc92c7d42986ef4e5fadf4a86.zip
Make --without-passwd-fallback work
This is derived in significant part from contributions to oe-core by Peter A. Bigot. I reworked the path routine a bit to use an already duplicated string instead of allocating copies of parts of it. The first issue was just that there was a missing antimagic() around some of the path operations. The second is that we wanted to have a way to provide a fallback password file which isn't the host's, but which can be used in the case where the target filesystem hasn't got a password yet, for bootstrapping purposes. (So there's a minimal password file that just has root, basically.) Also, I noticed a design flaw, which is that if you ended up calling pseudo_pwd_lck_open() twice in a row, the second time through, pseudo would first check whether it had a path name for the file (it does), and thus not allocate one, then call the close routine (which frees it and nulls the pointer), then open a new one... and not have a file name, so the next attempt to close it wouldn't unlink the file. This shouldn't ever come up in real code, but it was bugging me. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Diffstat (limited to 'pseudo_util.c')
-rw-r--r--pseudo_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index 9ff2587..d15373b 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -1269,7 +1269,7 @@ FILE *pseudo_host_etc_group_file = &pseudo_fake_group_file;
#endif
int
-pseudo_etc_file(const char *file, char *realname, int flags, char *search_dirs[], int dircount) {
+pseudo_etc_file(const char *file, char *realname, int flags, const char **search_dirs, int dircount) {
char filename[pseudo_path_max()];
int rc = -1;
@@ -1285,7 +1285,7 @@ pseudo_etc_file(const char *file, char *realname, int flags, char *search_dirs[]
return -1;
}
for (i = 0; i < dircount; ++i) {
- char *s = search_dirs[i];
+ const char *s = search_dirs[i];
if (!s)
continue;
#if PSEUDO_PORT_DARWIN