summaryrefslogtreecommitdiffstats
path: root/src/util/check_and_open.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-10-05 17:52:06 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-10-13 13:20:14 -0400
commitdbfc54be75b6d00879189e6f7ab82f65b17c1b9d (patch)
tree106fe315081669dd4a5c2ba422b741485cb193e9 /src/util/check_and_open.c
parent3620e966029229a7c246d1b79b0d3977699e6ab9 (diff)
downloadsssd_unused-dbfc54be75b6d00879189e6f7ab82f65b17c1b9d.tar.gz
sssd_unused-dbfc54be75b6d00879189e6f7ab82f65b17c1b9d.tar.xz
sssd_unused-dbfc54be75b6d00879189e6f7ab82f65b17c1b9d.zip
Add option to follow symlinks to check_file()
Diffstat (limited to 'src/util/check_and_open.c')
-rw-r--r--src/util/check_and_open.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/check_and_open.c b/src/util/check_and_open.c
index db926f10..27ef1c88 100644
--- a/src/util/check_and_open.c
+++ b/src/util/check_and_open.c
@@ -35,7 +35,7 @@ static errno_t perform_checks(struct stat *stat_buf,
errno_t check_file(const char *filename, const int uid, const int gid,
const int mode, enum check_file_type type,
- struct stat *caller_stat_buf)
+ struct stat *caller_stat_buf, bool follow_symlink)
{
int ret;
struct stat local_stat_buf;
@@ -47,7 +47,8 @@ errno_t check_file(const char *filename, const int uid, const int gid,
stat_buf = caller_stat_buf;
}
- ret = lstat(filename, stat_buf);
+ ret = follow_symlink ? stat(filename, stat_buf) : \
+ lstat(filename, stat_buf);
if (ret == -1) {
DEBUG(1, ("lstat for [%s] failed: [%d][%s].\n", filename, errno,
strerror(errno)));