aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-11-08 02:31:01 -0800
committerGuy Harris <guy@alum.mit.edu>2015-11-08 10:32:09 +0000
commitcaa1e87410fb74606f2ec91b5fd1b897053149bf (patch)
tree7d46afa570a24957716f5b74add64760bfeb5079 /wiretap
parent11bdadacc27d3781c3fd0d759068fddd3da9107c (diff)
Use ws_{read,write,fdopen,close}.
Be more consistent about using the ws_ routines, as we suggest in README.developer. In C++ on UN*X, define ws_close as ::close rather than close, so that it works even in classes with methods or members named "close". Change-Id: Ide2652229e6b6b4624cbddae0e909a4ea1efa591 Reviewed-on: https://code.wireshark.org/review/11637 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/file_access.c4
-rw-r--r--wiretap/file_wrappers.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index fad807bd2f..9d59f1274c 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -2513,14 +2513,14 @@ wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
if(wdh->compressed) {
return gzwfile_fdopen(fd);
} else {
- return fdopen(fd, "wb");
+ return ws_fdopen(fd, "wb");
}
}
#else
static WFILE_T
wtap_dump_file_fdopen(wtap_dumper *wdh _U_, int fd)
{
- return fdopen(fd, "wb");
+ return ws_fdopen(fd, "wb");
}
#endif
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index ea3ee3f0b4..5b4cbd27da 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -146,7 +146,7 @@ raw_read(FILE_T state, unsigned char *buf, unsigned int count, guint *have)
*have = 0;
do {
- ret = read(state->fd, buf + *have, count - *have);
+ ret = ws_read(state->fd, buf + *have, count - *have);
if (ret <= 0)
break;
*have += (unsigned)ret;
@@ -1498,7 +1498,7 @@ gzwfile_open(const char *path)
state = gzwfile_fdopen(fd);
if (state == NULL) {
save_errno = errno;
- close(fd);
+ ws_close(fd);
errno = save_errno;
}
return state;
@@ -1603,7 +1603,7 @@ gz_comp(GZWFILE_T state, int flush)
(flush != Z_FINISH || ret == Z_STREAM_END))) {
have = strm->next_out - state->next;
if (have) {
- got = write(state->fd, state->next, (unsigned int)have);
+ got = ws_write(state->fd, state->next, (unsigned int)have);
if (got < 0) {
state->err = errno;
return -1;
@@ -1732,7 +1732,7 @@ gzwfile_close(GZWFILE_T state)
g_free(state->out);
g_free(state->in);
state->err = Z_OK;
- if (close(state->fd) == -1 && ret == 0)
+ if (ws_close(state->fd) == -1 && ret == 0)
ret = errno;
g_free(state);
return ret;