lib: Add SAFE_FCHOWN()
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 5581a91..f482e01 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -662,6 +662,23 @@
return rval;
}
+
+int safe_fchown(const char *file, const int lineno, void (cleanup_fn)(void),
+ int fd, uid_t owner, gid_t group)
+{
+ int rval;
+
+ rval = fchown(fd, owner, group);
+
+ if (rval == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: fchown(%d,%d,%d) failed",
+ file, lineno, fd, owner, group);
+ }
+
+ return rval;
+}
+
pid_t safe_wait(const char *file, const int lineno, void (cleanup_fn)(void),
int *status)
{