diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-09-26 18:27:35 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-09-26 18:27:35 +0000 |
commit | 92acbe12bc9512100b9282d7e9d61fe86b5a60bb (patch) | |
tree | 80cd3c92c91f30818c60a97842a1f106a8cb27ac /src/common/util.h | |
parent | 9e5cafc395397426030e8098d64b8e25625863c5 (diff) | |
download | tor-92acbe12bc9512100b9282d7e9d61fe86b5a60bb.tar tor-92acbe12bc9512100b9282d7e9d61fe86b5a60bb.tar.gz |
Refactor common file code into util.c; add published to descriptors
svn:r487
Diffstat (limited to 'src/common/util.h')
-rw-r--r-- | src/common/util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h index 94fcd512d..c90175669 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -56,6 +56,18 @@ int read_all(int fd, void *buf, size_t count); void set_socket_nonblocking(int socket); +typedef enum { FN_ERROR, FN_NOENT, FN_FILE, FN_DIR} file_status_t; + +/* Return FN_ERROR if filename can't be read, FN_NOENT if it doesn't + * exist, FN_FILE if it is a regular file, or FN_DIR if it's a + * directory. */ +file_status_t file_status(const char *filename); +/* Check whether dirname exists and is private. If yes returns + * 0. Else returns -1. + */ +int check_private_dir(const char *dirname, int create); +int write_str_to_file(const char *fname, const char *str); + /* Minimalist interface to run a void function in the background. On unix calls fork, on win32 calls beginthread. Returns -1 on failure. func should not return, but rather should call spawn_exit. |