home
/
code
/
khatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
707b2f7
)
Revise variant labels and match EAGAIN symbolically
author
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 22 Mar 2020 01:22:02 +0000
(21:22 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 22 Mar 2020 01:22:02 +0000
(21:22 -0400)
x5/khatus.c
patch
|
blob
|
blame
|
history
diff --git
a/x5/khatus.c
b/x5/khatus.c
index
93550a9
..
9c84a7b
100644
(file)
--- a/
x5/khatus.c
+++ b/
x5/khatus.c
@@
-57,10
+57,10
@@
struct Config {
};
enum read_status {
};
enum read_status {
-
FAIL_FINAL = -2
,
-
FAIL_TMP = -1
,
-
END_OF_FILE = 0
,
- END_OF_MESSAGE = 1
+
END_OF_FILE
,
+
END_OF_MESSAGE
,
+
RETRY
,
+ FAILURE
};
void
};
void
@@
-340,10
+340,12
@@
fifo_read_one(Fifo *f, char *buf)
case -1:
error("Failed to read: \"%s\". errno: %d, msg: %s\n",
f->name, errno, strerror(errno));
case -1:
error("Failed to read: \"%s\". errno: %d, msg: %s\n",
f->name, errno, strerror(errno));
- if (errno == 11)
- return FAIL_TMP;
- else
- return FAIL_FINAL;
+ switch (errno) {
+ case EAGAIN:
+ return RETRY;
+ default:
+ return FAILURE;
+ }
case 0:
debug("%s: End of FILE\n", f->name);
f->pos_curr = f->pos_init;
case 0:
debug("%s: End of FILE\n", f->name);
f->pos_curr = f->pos_init;
@@
-418,12
+420,12
@@
fifo_read_all(Config *cfg, char *buf)
debug("reading: %s\n", f->name);
switch (fifo_read_one(f, buf)) {
case END_OF_FILE:
debug("reading: %s\n", f->name);
switch (fifo_read_one(f, buf)) {
case END_OF_FILE:
- case FAIL
_FINAL
:
+ case FAIL
URE
:
close(f->fd);
f->fd = -1;
break;
case END_OF_MESSAGE:
close(f->fd);
f->fd = -1;
break;
case END_OF_MESSAGE:
- case
FAIL_TMP
:
+ case
RETRY
:
break;
default:
assert(0);
break;
default:
assert(0);
This page took
0.020707 seconds
and
4
git commands to generate.