* Iterate over all files in the given directory and
* accumulate their size.
*
- * @param cls closure of type "struct GetFileSizeData"
+ * @param cls closure of type `struct GetFileSizeData`
* @param fn current filename we are looking at
- * @return GNUNET_SYSERR on serious errors, otherwise GNUNET_OK
+ * @return #GNUNET_SYSERR on serious errors, otherwise #GNUNET_OK
*/
static int
getSizeRec (void *cls, const char *fn)
* Checks whether a handle is invalid
*
* @param h handle to check
- * @return GNUNET_YES if invalid, GNUNET_NO if valid
+ * @return #GNUNET_YES if invalid, #GNUNET_NO if valid
*/
int
GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h)
*
* @param fh open file handle
* @param size where to write size of the file
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
* @param h handle of an open file
* @param offset position to move to
* @param whence specification to which position the offset parameter relates to
- * @return the new position on success, GNUNET_SYSERR otherwise
+ * @return the new position on success, #GNUNET_SYSERR otherwise
*/
off_t
GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, off_t offset,
* of all sizes of files in the directory)
* @param include_symbolic_links should symbolic links be
* included?
- * @param single_file_mode GNUNET_YES to only get size of one file
- * and return GNUNET_SYSERR for directories.
- * @return GNUNET_SYSERR on error, GNUNET_OK on success
+ * @param single_file_mode #GNUNET_YES to only get size of one file
+ * and return #GNUNET_SYSERR for directories.
+ * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
int
-GNUNET_DISK_file_size (const char *filename, uint64_t * size,
- int include_symbolic_links, int single_file_mode)
+GNUNET_DISK_file_size (const char *filename,
+ uint64_t * size,
+ int include_symbolic_links,
+ int single_file_mode)
{
struct GetFileSizeData gfsd;
int ret;
* (of a file that exists and that is not a directory).
*
* @param fil filename to check
- * @return #GNUNET_YES if yes, GNUNET_NO if not a file, #GNUNET_SYSERR if something
+ * @return #GNUNET_YES if yes, #GNUNET_NO if not a file, #GNUNET_SYSERR if something
* else (will print an error message in that case, too).
*/
int
*
* @param unused not used
* @param fn directory to remove
- * @return GNUNET_OK
+ * @return #GNUNET_OK
*/
static int
remove_helper (void *unused, const char *fn)
* Remove all files in a directory (rm -rf). Call with
* caution.
*
- *
* @param filename the file to remove
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_DISK_directory_remove (const char *filename)
{
struct stat istat;
+ if (NULL == filename)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
if (0 != LSTAT (filename, &istat))
return GNUNET_NO; /* file may not exist... */
(void) CHMOD (filename, S_IWUSR | S_IRUSR | S_IXUSR);
* @param fn file name to be opened
* @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit flags
* @param perm permissions for the newly created file, use
- * #GNUNET_DISK_PERM_USER_NONE if a file could not be created by this
+ * #GNUNET_DISK_PERM_NONE if a file could not be created by this
* call (because of flags)
* @return IO handle on success, NULL on error
*/