Mercurial > gnulib
comparison lib/execute.c @ 17345:41cddf8f3b4d
execute: Revert last change, but use a different condition.
* lib/execute.c (nonintr_close, nonintr_open): Reintroduce, but only
on Windows.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 06 Mar 2013 23:23:07 +0100 |
parents | aea18ef5eadd |
children | 344018b6e5d7 |
comparison
equal
deleted
inserted
replaced
17344:aea18ef5eadd | 17345:41cddf8f3b4d |
---|---|
50 | 50 |
51 /* The results of open() in this file are not used with fchdir, | 51 /* The results of open() in this file are not used with fchdir, |
52 therefore save some unnecessary work in fchdir.c. */ | 52 therefore save some unnecessary work in fchdir.c. */ |
53 #undef open | 53 #undef open |
54 #undef close | 54 #undef close |
55 | |
56 | |
57 #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) | |
58 | |
59 /* EINTR handling for close(), open(). | |
60 These functions can return -1/EINTR even though we don't have any | |
61 signal handlers set up, namely when we get interrupted via SIGSTOP. */ | |
62 | |
63 static int | |
64 nonintr_close (int fd) | |
65 { | |
66 int retval; | |
67 | |
68 do | |
69 retval = close (fd); | |
70 while (retval < 0 && errno == EINTR); | |
71 | |
72 return retval; | |
73 } | |
74 #define close nonintr_close | |
75 | |
76 static int | |
77 nonintr_open (const char *pathname, int oflag, mode_t mode) | |
78 { | |
79 int retval; | |
80 | |
81 do | |
82 retval = open (pathname, oflag, mode); | |
83 while (retval < 0 && errno == EINTR); | |
84 | |
85 return retval; | |
86 } | |
87 #undef open /* avoid warning on VMS */ | |
88 #define open nonintr_open | |
89 | |
90 #endif | |
55 | 91 |
56 | 92 |
57 /* Execute a command, optionally redirecting any of the three standard file | 93 /* Execute a command, optionally redirecting any of the three standard file |
58 descriptors to /dev/null. Return its exit code. | 94 descriptors to /dev/null. Return its exit code. |
59 If it didn't terminate correctly, exit if exit_on_error is true, otherwise | 95 If it didn't terminate correctly, exit if exit_on_error is true, otherwise |