diff options
author | Florian Dold <florian@dold.me> | 2021-07-28 15:26:55 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-07-28 15:27:39 +0200 |
commit | 94ea7a1fab12d1ad81209f84087c04a5a5b790dc (patch) | |
tree | dc33d6aaefd9ec6e8b781e000569c7029bd51cf8 /src/util/disk.c | |
parent | 7615d46b09275383bd244a0ef1d94b3a77559b88 (diff) | |
download | gnunet-94ea7a1fab12d1ad81209f84087c04a5a5b790dc.tar.gz gnunet-94ea7a1fab12d1ad81209f84087c04a5a5b790dc.zip |
implement @inline-secret@ directive
Diffstat (limited to 'src/util/disk.c')
-rw-r--r-- | src/util/disk.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index 1b909f13e..f68b32db5 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -432,9 +432,15 @@ GNUNET_DISK_directory_test (const char *fil, int is_readable) | |||
432 | return GNUNET_YES; | 432 | return GNUNET_YES; |
433 | } | 433 | } |
434 | 434 | ||
435 | 435 | /** | |
436 | enum GNUNET_GenericReturnValue | 436 | * Check if fil can be accessed using amode. |
437 | GNUNET_DISK_file_test (const char *fil) | 437 | * |
438 | * @param fil file to check for | ||
439 | * @param amode access mode | ||
440 | * @returns GNUnet error code | ||
441 | */ | ||
442 | static enum GNUNET_GenericReturnValue | ||
443 | file_test_internal (const char *fil, int amode) | ||
438 | { | 444 | { |
439 | struct stat filestat; | 445 | struct stat filestat; |
440 | int ret; | 446 | int ret; |
@@ -461,7 +467,7 @@ GNUNET_DISK_file_test (const char *fil) | |||
461 | GNUNET_free (rdir); | 467 | GNUNET_free (rdir); |
462 | return GNUNET_NO; | 468 | return GNUNET_NO; |
463 | } | 469 | } |
464 | if (access (rdir, F_OK) < 0) | 470 | if (access (rdir, amode) < 0) |
465 | { | 471 | { |
466 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", rdir); | 472 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", rdir); |
467 | GNUNET_free (rdir); | 473 | GNUNET_free (rdir); |
@@ -473,6 +479,20 @@ GNUNET_DISK_file_test (const char *fil) | |||
473 | 479 | ||
474 | 480 | ||
475 | enum GNUNET_GenericReturnValue | 481 | enum GNUNET_GenericReturnValue |
482 | GNUNET_DISK_file_test (const char *fil) | ||
483 | { | ||
484 | return file_test_internal (fil, F_OK); | ||
485 | } | ||
486 | |||
487 | |||
488 | enum GNUNET_GenericReturnValue | ||
489 | GNUNET_DISK_file_test_read (const char *fil) | ||
490 | { | ||
491 | return file_test_internal (fil, R_OK); | ||
492 | } | ||
493 | |||
494 | |||
495 | enum GNUNET_GenericReturnValue | ||
476 | GNUNET_DISK_directory_create (const char *dir) | 496 | GNUNET_DISK_directory_create (const char *dir) |
477 | { | 497 | { |
478 | char *rdir; | 498 | char *rdir; |