diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-12-07 11:33:18 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-12-07 11:33:18 +0200 |
commit | 8769e540f1d3c25ba05c5d24b69a8b71cfd8dc6b (patch) | |
tree | 69f84c95201f7830d7972334e3ee118a7d1cb357 /rpmio | |
parent | 2cce0653a15f6a0bdcb4de8b7a5133e810744d32 (diff) | |
download | rpm-8769e540f1d3c25ba05c5d24b69a8b71cfd8dc6b.tar.gz rpm-8769e540f1d3c25ba05c5d24b69a8b71cfd8dc6b.tar.bz2 rpm-8769e540f1d3c25ba05c5d24b69a8b71cfd8dc6b.zip |
Don't do tilde expansion if HOME not set
- If you dont have a home, glob() will go out of its way to give you one,
even a wrong one. This isn't good when daemons etc have purposefully
unset HOME...
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmfileutil.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index b19ccc7eb..9f31c7956 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -710,6 +710,8 @@ int rpmGlob(const char * patterns, int * argcPtr, const char *** argvPtr) int argc = 0; const char ** argv = NULL; char * globRoot = NULL; + const char *home = getenv("HOME"); + int gflags = 0; #ifdef ENABLE_NLS const char * old_collate = NULL; const char * old_ctype = NULL; @@ -719,6 +721,9 @@ int rpmGlob(const char * patterns, int * argcPtr, const char *** argvPtr) int i, j; int rc; + if (home != NULL && strlen(home) > 0) + gflags |= GLOB_TILDE; + rc = XpoptParseArgvString(patterns, &ac, &av); if (rc) return rc; @@ -752,7 +757,8 @@ fprintf(stderr, "*** rpmGlob argv[%d] \"%s\"\n", argc, argv[argc]); gl.gl_pathc = 0; gl.gl_pathv = NULL; - rc = glob(av[j], GLOB_TILDE, NULL, &gl); + + rc = glob(av[j], gflags, NULL, &gl); if (rc) goto exit; |