Try again to open() on EINTR

This commit is contained in:
angt
2015-11-17 21:39:56 +01:00
parent 310e499234
commit 89d2edb61b

View File

@@ -471,9 +471,13 @@ static int gt_setup_secretkey (struct crypto_ctx *ctx, char *keyfile)
if (!keyfile)
return 0;
int fd = open(keyfile, O_RDONLY|O_CLOEXEC);
int fd;
if (fd<0) {
do {
fd = open(keyfile, O_RDONLY|O_CLOEXEC);
} while (fd==-1 && errno==EINTR);
if (fd==-1) {
perror("open keyfile");
return -1;
}