aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-25 08:41:56 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-25 08:41:56 +0000
commit00c4cd3fbb54ef5860c3fa4c13d5318391d61a6e (patch)
tree4e01c20bcc2e129ecbc7295755685ea264c9e26d /src/util/disk.c
parent130185df47d89b3df36c8371fe18eccd76fca7fc (diff)
downloadgnunet-00c4cd3fbb54ef5860c3fa4c13d5318391d61a6e.tar.gz
gnunet-00c4cd3fbb54ef5860c3fa4c13d5318391d61a6e.zip
-nocaps
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index b4674c99b..5d37372ea 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1352,34 +1352,34 @@ remove_helper (void *unused, const char *fn)
1352 * caution. 1352 * caution.
1353 * 1353 *
1354 * 1354 *
1355 * @param fileName the file to remove 1355 * @param filename the file to remove
1356 * @return GNUNET_OK on success, GNUNET_SYSERR on error 1356 * @return GNUNET_OK on success, GNUNET_SYSERR on error
1357 */ 1357 */
1358int 1358int
1359GNUNET_DISK_directory_remove (const char *fileName) 1359GNUNET_DISK_directory_remove (const char *filename)
1360{ 1360{
1361 struct stat istat; 1361 struct stat istat;
1362 1362
1363 if (0 != LSTAT (fileName, &istat)) 1363 if (0 != LSTAT (filename, &istat))
1364 return GNUNET_NO; /* file may not exist... */ 1364 return GNUNET_NO; /* file may not exist... */
1365 CHMOD (fileName, S_IWUSR | S_IRUSR | S_IXUSR); 1365 (void) CHMOD (filename, S_IWUSR | S_IRUSR | S_IXUSR);
1366 if (UNLINK (fileName) == 0) 1366 if (UNLINK (filename) == 0)
1367 return GNUNET_OK; 1367 return GNUNET_OK;
1368 if ((errno != EISDIR) && 1368 if ((errno != EISDIR) &&
1369 /* EISDIR is not sufficient in all cases, e.g. 1369 /* EISDIR is not sufficient in all cases, e.g.
1370 * sticky /tmp directory may result in EPERM on BSD. 1370 * sticky /tmp directory may result in EPERM on BSD.
1371 * So we also explicitly check "isDirectory" */ 1371 * So we also explicitly check "isDirectory" */
1372 (GNUNET_YES != GNUNET_DISK_directory_test (fileName))) 1372 (GNUNET_YES != GNUNET_DISK_directory_test (filename)))
1373 { 1373 {
1374 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "rmdir", fileName); 1374 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "rmdir", filename);
1375 return GNUNET_SYSERR; 1375 return GNUNET_SYSERR;
1376 } 1376 }
1377 if (GNUNET_SYSERR == 1377 if (GNUNET_SYSERR ==
1378 GNUNET_DISK_directory_scan (fileName, &remove_helper, NULL)) 1378 GNUNET_DISK_directory_scan (filename, &remove_helper, NULL))
1379 return GNUNET_SYSERR; 1379 return GNUNET_SYSERR;
1380 if (0 != RMDIR (fileName)) 1380 if (0 != RMDIR (filename))
1381 { 1381 {
1382 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "rmdir", fileName); 1382 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "rmdir", filename);
1383 return GNUNET_SYSERR; 1383 return GNUNET_SYSERR;
1384 } 1384 }
1385 return GNUNET_OK; 1385 return GNUNET_OK;