diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-08-25 20:04:42 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-08-25 20:04:42 +0000 |
commit | c43a9ae78220daadd71e00fc0596ceb839621e28 (patch) | |
tree | f263485ed0a09b31afe38be42e151cf9fc1dad9c /src/getfs_a.c | |
download | libfstab-master.tar.gz libfstab-master.tar.xz libfstab-master.zip |
Diffstat (limited to 'src/getfs_a.c')
-rw-r--r-- | src/getfs_a.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/getfs_a.c b/src/getfs_a.c new file mode 100644 index 0000000..22a18d2 --- /dev/null +++ b/src/getfs_a.c @@ -0,0 +1,29 @@ +#include <pthread.h> +#include "fsent.h" + +int __getfs_a(char const *spec, char const *file, struct fstab *fstab, char **line, size_t *size) +{ + int r; + int cs; + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); + + FILE *f = fopen(_PATH_FSTAB, "rbe"); + if (!f) + { + pthread_setcancelstate(cs, 0); + return 0; + } + + for (;;) + { + r = __getfsent_a(f, fstab, line, size); + if (!r) break; + if (spec && !strcmp(spec, fstab->fs_spec) + || file && !strcmp(file, fstab->fs_file)) + break; + } + + __fclose_keep_errno(f); + pthread_setcancelstate(cs, 0); + return r; +} |