apps/examples/fstest: Ignore EINTR errors while reading or writing.
This commit is contained in:
parent
4e6b356123
commit
8b632d42b5
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/fstest/fstest_main.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -446,6 +446,10 @@ static inline int fstest_wrfile(FAR struct fstest_filedesc_s *file)
|
||||
printf(" Write size: %ld\n", (long)nbytestowrite);
|
||||
ret = ERROR;
|
||||
}
|
||||
else if (errcode == EINTR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret2;
|
||||
@ -546,8 +550,14 @@ static ssize_t fstest_rdblock(int fd, FAR struct fstest_filedesc_s *file,
|
||||
len = maxio;
|
||||
}
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
nbytesread = read(fd, &g_fileimage[offset], len);
|
||||
if (nbytesread < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
|
||||
if (errcode != EINTR)
|
||||
{
|
||||
printf("ERROR: Failed to read file: %d\n", errno);
|
||||
printf(" File name: %s\n", file->name);
|
||||
@ -556,6 +566,7 @@ static ssize_t fstest_rdblock(int fd, FAR struct fstest_filedesc_s *file,
|
||||
printf(" Read size: %ld\n", (long)len);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
else if (nbytesread == 0)
|
||||
{
|
||||
#if 0 /* No... we do this on purpose sometimes */
|
||||
@ -579,6 +590,7 @@ static ssize_t fstest_rdblock(int fd, FAR struct fstest_filedesc_s *file,
|
||||
|
||||
return nbytesread;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fstest_rdfile
|
||||
|
Loading…
Reference in New Issue
Block a user