mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
my_close(), my_sync(): retry if EINTR
mysys/my_open.c: my_close(): retry if EINTR mysys/my_sync.c: fsync(): retry if EINTR
This commit is contained in:
@@ -79,7 +79,12 @@ int my_close(File fd, myf MyFlags)
|
|||||||
DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
|
DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
|
||||||
|
|
||||||
pthread_mutex_lock(&THR_LOCK_open);
|
pthread_mutex_lock(&THR_LOCK_open);
|
||||||
if ((err = close(fd)))
|
do
|
||||||
|
{
|
||||||
|
err= close(fd);
|
||||||
|
} while (err == -1 && errno == EINTR);
|
||||||
|
|
||||||
|
if (err)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error",("Got error %d on close",err));
|
DBUG_PRINT("error",("Got error %d on close",err));
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
|
@@ -40,15 +40,19 @@ int my_sync(File fd, myf my_flags)
|
|||||||
DBUG_ENTER("my_sync");
|
DBUG_ENTER("my_sync");
|
||||||
DBUG_PRINT("my",("Fd: %d my_flags: %d", fd, my_flags));
|
DBUG_PRINT("my",("Fd: %d my_flags: %d", fd, my_flags));
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
#if defined(HAVE_FDATASYNC)
|
#if defined(HAVE_FDATASYNC)
|
||||||
res= fdatasync(fd);
|
res= fdatasync(fd);
|
||||||
#elif defined(HAVE_FSYNC)
|
#elif defined(HAVE_FSYNC)
|
||||||
res=fsync(fd);
|
res= fsync(fd);
|
||||||
#elif defined(__WIN__)
|
#elif defined(__WIN__)
|
||||||
res= _commit(fd);
|
res= _commit(fd);
|
||||||
#else
|
#else
|
||||||
res= 0; /* No sync (strange OS) */
|
res= 0; /* No sync (strange OS) */
|
||||||
#endif
|
#endif
|
||||||
|
} while (res == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
if (!(my_errno= errno))
|
if (!(my_errno= errno))
|
||||||
|
Reference in New Issue
Block a user