summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-26 16:59:53 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-26 19:21:58 +0100
commitc75f27ea2b483f91d437ebaf8494457dc76f3fd6 (patch)
tree149a22a4d7392c93c1fc701bb8a820302d364107
parent86e339c8846cdf614a41653384c0b4e84b233696 (diff)
test: improve btrfs test case
-rw-r--r--src/test/test-btrfs.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index 4a08c72fbb..43b445d831 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -29,26 +29,30 @@
int main(int argc, char *argv[]) {
int r;
- BtrfsSubvolInfo info;
- char ts[FORMAT_TIMESTAMP_MAX];
int fd;
fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
if (fd < 0)
log_error_errno(errno, "Failed to open root directory: %m");
else {
+ BtrfsSubvolInfo info;
+ char ts[FORMAT_TIMESTAMP_MAX];
+
r = btrfs_subvol_get_info_fd(fd, &info);
if (r < 0)
log_error_errno(r, "Failed to get subvolume info: %m");
else {
log_info("otime: %s", format_timestamp(ts, sizeof(ts), info.otime));
- log_info("read-only: %s", yes_no(info.read_only));
+ log_info("read-only (search): %s", yes_no(info.read_only));
}
r = btrfs_subvol_get_read_only_fd(fd);
- assert_se(r >= 0);
+ if (r < 0)
+ log_error_errno(r, "Failed to get read only flag: %m");
+ else
+ log_info("read-only (ioctl): %s", yes_no(r));
- log_info("read-only: %s", yes_no(r));
+ safe_close(fd);
}
r = btrfs_subvol_make("/xxxtest");