safe_macros: Add SAFE_LINK and SAFE_SYMLINK.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 0668584..4da9914 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -294,6 +294,41 @@
 	return (rval);
 }
 
+
+int safe_link(const char *file, const int lineno,
+              void (cleanup_fn)(void), const char *oldpath,
+              const char *newpath)
+{
+	int rval;
+
+	rval = link(oldpath, newpath);
+
+	if (rval == -1) {
+		tst_brkm(TBROK | TERRNO, cleanup_fn,
+		         "link(%s, %s) failed at %s:%d",
+			 oldpath, newpath, file, lineno);
+	}
+
+	return rval;
+}
+
+int safe_symlink(const char *file, const int lineno,
+                 void (cleanup_fn)(void), const char *oldpath,
+                 const char *newpath)
+{
+	int rval;
+
+	rval = symlink(oldpath, newpath);
+
+	if (rval == -1) {
+		tst_brkm(TBROK | TERRNO, cleanup_fn,
+		         "link(%s, %s) failed at %s:%d",
+			 oldpath, newpath, file, lineno);
+	}
+
+	return rval;
+}
+
 ssize_t
 safe_write(const char *file, const int lineno, void (cleanup_fn) (void),
 	   char len_strict, int fildes, const void *buf, size_t nbyte)