summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2009-12-26 21:04:23 +0100
committerGuillem Jover <guillem@debian.org>2009-12-31 20:51:51 +0100
commitdde9a226d5f831c773539ee8c58f861148fd7c5e (patch)
treea462d663faf30d25ccb2d9096d3628ea93aad8d8
parent863943468eb0c3e1431c7223325a469e223dcd72 (diff)
downloaddpkg-dde9a226d5f831c773539ee8c58f861148fd7c5e.tar.gz
Use stat instead of access to check for file existence
-rw-r--r--src/statcmd.c4
-rw-r--r--utils/start-stop-daemon.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/statcmd.c b/src/statcmd.c
index 8dffe5eda..09e5856cd 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -279,7 +279,9 @@ statoverride_add(const char *const *argv)
*filestat = statdb_node_new(user, group, mode);
if (opt_update) {
- if (access(filename, F_OK) == 0)
+ struct stat st;
+
+ if (stat(filename, &st) == 0)
statdb_node_apply(filename, *filestat);
else if (opt_verbose)
warning(_("--update given but %s does not exist"),
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 2cb45199f..8126b2e8d 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1494,6 +1494,7 @@ main(int argc, char **argv)
}
if (changeuser) {
struct passwd *pw;
+ struct stat st;
if (sscanf(changeuser, "%d", &runas_uid) == 1)
pw = getpwuid(runas_uid);
@@ -1507,7 +1508,7 @@ main(int argc, char **argv)
changegroup = ""; /* Just empty. */
runas_gid = pw->pw_gid;
}
- if (access(pw->pw_dir, F_OK) == 0)
+ if (stat(pw->pw_dir, &st) == 0)
setenv("HOME", pw->pw_dir, 1);
}