MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / read__fixio

Function read__fixio

extern/editline/src/read.c:126–181  ·  view source on GitHub ↗

read__fixio(): * Try to recover from a read error */ ARGSUSED */

Source from the content-addressed store, hash-verified

124 */
125/* ARGSUSED */
126private int
127read__fixio(int fd __attribute__((__unused__)), int e)
128{
129
130 switch (e) {
131 case -1: /* Make sure that the code is reachable */
132
133#ifdef EWOULDBLOCK
134 case EWOULDBLOCK:
135#ifndef TRY_AGAIN
136#define TRY_AGAIN
137#endif
138#endif /* EWOULDBLOCK */
139
140#if defined(POSIX) && defined(EAGAIN)
141#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
142 case EAGAIN:
143#ifndef TRY_AGAIN
144#define TRY_AGAIN
145#endif
146#endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
147#endif /* POSIX && EAGAIN */
148
149 e = 0;
150#ifdef TRY_AGAIN
151#if defined(F_SETFL) && defined(O_NDELAY)
152 if ((e = fcntl(fd, F_GETFL, 0)) == -1)
153 return -1;
154
155 if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1)
156 return -1;
157 else
158 e = 1;
159#endif /* F_SETFL && O_NDELAY */
160
161#ifdef FIONBIO
162 {
163 int zero = 0;
164
165 if (ioctl(fd, FIONBIO, &zero) == -1)
166 return -1;
167 else
168 e = 1;
169 }
170#endif /* FIONBIO */
171
172#endif /* TRY_AGAIN */
173 return e ? 0 : -1;
174
175 case EINTR:
176 return 0;
177
178 default:
179 return -1;
180 }
181}
182
183

Callers 1

read_charFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected