commit: 8e5479494a1df4b326ca9715ee72897d2b98b06f Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Sun Mar 16 06:22:38 2014 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Sun Mar 16 06:22:38 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=8e547949
q: fix up --install a little Update the outdated chdir error message, and use O_PATH with the dirfd. --- q.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/q.c b/q.c index 849f7ad..394a035 100644 --- a/q.c +++ b/q.c @@ -95,7 +95,7 @@ int q_main(int argc, char **argv) if (install) { char buf[_Q_PATH_MAX]; - const char *prog; + const char *prog, *dir; ssize_t rret; int fd, ret; @@ -115,9 +115,10 @@ int q_main(int argc, char **argv) buf[rret] = '\0'; prog = basename(buf); - fd = open(dirname(buf), O_RDONLY|O_CLOEXEC); + dir = dirname(buf); + fd = open(dir, O_RDONLY|O_CLOEXEC|O_PATH); if (fd < 0) { - warnfp("chdir(%s) failed", buf); + warnfp("open(%s) failed", dir); return 1; }