aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_util.c
diff options
context:
space:
mode:
authorPeter Seebach <seebs@eee12.(none)>2010-04-06 14:31:03 -0500
committerPeter Seebach <peter.seebach@windriver.com>2010-04-26 17:13:44 -0700
commit4038d0599e135ea0099a2392e0421bcc1d053825 (patch)
tree8086d39e5752779b5b26d6d80df174d1eaf6fdcd /pseudo_util.c
parent390c8ad100345356ddcbcad89011474d4d54b244 (diff)
downloadpseudo-4038d0599e135ea0099a2392e0421bcc1d053825.tar.gz
pseudo-4038d0599e135ea0099a2392e0421bcc1d053825.tar.bz2
pseudo-4038d0599e135ea0099a2392e0421bcc1d053825.zip
Miscellaneous fixes:
* Add lckpwdf/ulckpwdf to guts/README * Remove arguments from function pointer arguments. While in theory the compar function pointer has always taken "const struct dirent **", some systems (many) have declared it instead as taking "const void *". For now, just omit the types; a pointer to function taking unknown arguments is a compatible type, and we never call the functions, we just pass them to something else. * Handle readlinkat() on systems without *at functions * Fix pseudo_etc_file (spotted by "fortify") When O_CREAT can be a flag, 0600 mode is needed. While we're at it, remove a bogus dummy open. * Fix mkdtemp() Was returning the address of the internal buffer rather than the user-provided buffer. Also fixed a typo in an error message. * Don't call fgetgrent_r() with a null FILE *. * A couple of other typo-type fixes.
Diffstat (limited to 'pseudo_util.c')
-rw-r--r--pseudo_util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index bef86ad..62ad848 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -646,7 +646,11 @@ pseudo_etc_file(const char *file, char *realname, int flags, char **search_dirs,
continue;
snprintf(filename, pseudo_path_max(), "%s/etc/%s",
s, file);
- rc = open(filename, flags);
+ if (flags & O_CREAT) {
+ rc = open(filename, flags, 0600);
+ } else {
+ rc = open(filename, flags);
+ }
if (rc >= 0) {
if (realname)
strcpy(realname, filename);
@@ -664,7 +668,11 @@ pseudo_etc_file(const char *file, char *realname, int flags, char **search_dirs,
snprintf(filename, pseudo_path_max(), "/etc/%s", file);
pseudo_debug(2, "falling back on <%s> for <%s>\n",
filename, file);
- rc = open(filename, flags);
+ if (flags & O_CREAT) {
+ rc = open(filename, flags, 0600);
+ } else {
+ rc = open(filename, flags);
+ }
if (rc >= 0 && realname)
strcpy(realname, filename);
return rc;