]> git.ozlabs.org Git - ccan/blobdiff - ccan/noerr/noerr.h
Move modules to ccan/ tools to tools/
[ccan] / ccan / noerr / noerr.h
diff --git a/ccan/noerr/noerr.h b/ccan/noerr/noerr.h
new file mode 100644 (file)
index 0000000..559ba61
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef NOERR_H
+#define NOERR_H
+
+/**
+ * close_noerr - close without stomping errno.
+ * @fd: the file descriptor to close.
+ *
+ * errno is saved and restored across the call to close: if an error occurs,
+ * the resulting (non-zero) errno is returned.
+ */
+int close_noerr(int fd);
+
+/**
+ * unlink_noerr - unlink a file without stomping errno.
+ * @pathname: the path to unlink.
+ *
+ * errno is saved and restored across the call to unlink: if an error occurs,
+ * the resulting (non-zero) errno is returned.
+ */
+int unlink_noerr(const char *pathname);
+
+#endif /* NOERR_H */