summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-30 19:21:32 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-30 19:21:32 -0500
commit4517a48bccf68f16958ed86107f6a4a649925586 (patch)
treee6f024fd1018c7816d2042ef4772d4fb4dd56a68
parent4ac5972811a711f9b26e34fd6b6d6df7f5407953 (diff)
downloadlibgit2-4517a48bccf68f16958ed86107f6a4a649925586.tar.gz
futils: document mktmp's safety
-rw-r--r--src/futils.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/futils.h b/src/futils.h
index 1386dc482..782cf3271 100644
--- a/src/futils.h
+++ b/src/futils.h
@@ -173,8 +173,16 @@ typedef enum {
extern int git_futils_rmdir_r(const char *path, const char *base, uint32_t flags);
/**
- * Create and open a temporary file with a `_git2_` suffix.
- * Writes the filename into path_out.
+ * Create and open a temporary file with a `_git2_` suffix in a
+ * protected directory; the file created will created will honor
+ * the current `umask`. Writes the filename into path_out.
+ *
+ * This function is *NOT* suitable for use in temporary directories
+ * that are world writable. It uses `mktemp` (for portability) and
+ * many `mktemp` implementations use weak random characters. It
+ * should only be assumed to be suitable for atomically writing
+ * a new file in a directory that you control.
+ *
* @return On success, an open file descriptor, else an error code < 0.
*/
extern int git_futils_mktmp(git_str *path_out, const char *filename, mode_t mode);