Mercurial > dropbear
comparison fuzz-wrapfd.c @ 1360:16f45f2df38f fuzz
ignore wrapfd_close for unknown
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 21 May 2017 10:48:18 +0800 |
parents | 6b89eb92f872 |
children | d4cc85e6c569 |
comparison
equal
deleted
inserted
replaced
1359:665dd8957a67 | 1360:16f45f2df38f |
---|---|
42 assert(fd >= 0); | 42 assert(fd >= 0); |
43 assert(fd <= IOWRAP_MAXFD); | 43 assert(fd <= IOWRAP_MAXFD); |
44 assert(wrap_fds[fd].mode == UNUSED); | 44 assert(wrap_fds[fd].mode == UNUSED); |
45 assert(buf || mode == RANDOMIN); | 45 assert(buf || mode == RANDOMIN); |
46 | 46 |
47 | |
48 wrap_fds[fd].mode = mode; | 47 wrap_fds[fd].mode = mode; |
49 wrap_fds[fd].buf = buf; | 48 wrap_fds[fd].buf = buf; |
50 wrap_fds[fd].closein = 0; | 49 wrap_fds[fd].closein = 0; |
51 wrap_fds[fd].closeout = 0; | 50 wrap_fds[fd].closeout = 0; |
52 wrap_used[nused] = fd; | 51 wrap_used[nused] = fd; |
71 } | 70 } |
72 } | 71 } |
73 nused--; | 72 nused--; |
74 } | 73 } |
75 | 74 |
76 void wrapfd_close(int fd) { | 75 int wrapfd_close(int fd) { |
77 wrapfd_remove(fd); | 76 if (fd >= 0 && fd <= IOWRAP_MAXFD && wrap_fds[fd].mode != UNUSED) |
77 { | |
78 wrapfd_remove(fd); | |
79 return 0; | |
80 } | |
81 else { | |
82 return close(fd); | |
83 } | |
78 } | 84 } |
79 | 85 |
80 int wrapfd_read(int fd, void *out, size_t count) { | 86 int wrapfd_read(int fd, void *out, size_t count) { |
81 size_t maxread; | 87 size_t maxread; |
82 buffer *buf; | 88 buffer *buf; |