aboutsummaryrefslogtreecommitdiff
path: root/contrib/getdents-debug/getdents_c
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-29 20:35:59 +0200
committerJakob Unterwurzacher2020-07-29 20:35:59 +0200
commit8afbbc86d170c49bbbdd801f43cd77774bcde13e (patch)
tree8795832cf9bd705635b553e5fe140f1851e4f8cc /contrib/getdents-debug/getdents_c
parent507345929617876f306b20eb541c9126945fba2c (diff)
getdents_c: continue on EINTR from open
Getting EINTR here is acceptable.
Diffstat (limited to 'contrib/getdents-debug/getdents_c')
-rw-r--r--contrib/getdents-debug/getdents_c/getdents.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/getdents-debug/getdents_c/getdents.c b/contrib/getdents-debug/getdents_c/getdents.c
index 936bd0b..94f8c97 100644
--- a/contrib/getdents-debug/getdents_c/getdents.c
+++ b/contrib/getdents-debug/getdents_c/getdents.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <sys/syscall.h>
#include <errno.h>
+#include <string.h>
int main(int argc, char *argv[])
{
@@ -23,7 +24,10 @@ int main(int argc, char *argv[])
for (int i = 1 ; ; i ++ ) {
int fd = open(path, O_RDONLY);
if (fd == -1) {
- perror("open");
+ printf("%3d: open: %s\n", i, strerror(errno));
+ if(errno == EINTR) {
+ continue;
+ }
exit(1);
}
@@ -31,6 +35,7 @@ int main(int argc, char *argv[])
int sum = 0;
printf("%3d: getdents64: ", i);
for ( ; ; ) {
+ errno = 0;
int n = syscall(SYS_getdents64, fd, tmp, sizeof(tmp));
printf("n=%d; ", n);
if (n <= 0) {