summaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-08-05 13:13:52 +0300
committerTimo Teras <timo.teras@iki.fi>2009-08-05 13:13:52 +0300
commit46e93295688385af6b4b5d17f97675087a90aba4 (patch)
tree4af28531ab57f08a5ba58841fa9d385a93cdb3ab /src/io.c
parent856181a0325d39e7d26566f118bc4219e3837a4b (diff)
downloadapk-tools-46e93295688385af6b4b5d17f97675087a90aba4.tar.bz2
apk-tools-46e93295688385af6b4b5d17f97675087a90aba4.tar.xz
io: flag for following symlinks on fstat
usually we are interested on the actual file's length. but audit is interested about the link. so add a flag for this and use it in audit.
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/io.c b/src/io.c
index a6cdd4d..50da3da 100644
--- a/src/io.c
+++ b/src/io.c
@@ -463,13 +463,17 @@ err_fd:
return APK_BLOB_NULL;
}
-int apk_file_get_info(int atfd, const char *filename, int checksum,
+int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi)
{
struct stat64 st;
struct apk_bstream *bs;
+ int checksum = flags & 0xffff, atflags = 0;
- if (fstatat64(atfd, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)
+ if (flags & APK_FI_NOFOLLOW)
+ atflags |= AT_SYMLINK_NOFOLLOW;
+
+ if (fstatat64(atfd, filename, &st, atflags) != 0)
return -errno;
*fi = (struct apk_file_info) {