Rename an argument to avoid colliding with pipe().
svn path=/trunk/; revision=25556
This commit is contained in:
parent
ddb5a7a13f
commit
3d2c418ba7
|
@ -1047,22 +1047,22 @@ static gboolean pipe_data_available(int pipe) {
|
|||
|
||||
/* Read a line from a pipe, similar to fgets */
|
||||
int
|
||||
sync_pipe_gets_nonblock(int pipe, char *bytes, int max) {
|
||||
sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max) {
|
||||
int newly;
|
||||
int offset = -1;
|
||||
|
||||
while(offset < max - 1) {
|
||||
offset++;
|
||||
if (! pipe_data_available(pipe))
|
||||
if (! pipe_data_available(pipe_fd))
|
||||
break;
|
||||
newly = read(pipe, &bytes[offset], 1);
|
||||
newly = read(pipe_fd, &bytes[offset], 1);
|
||||
if (newly == 0) {
|
||||
/* EOF - not necessarily an error */
|
||||
break;
|
||||
} else if (newly < 0) {
|
||||
/* error */
|
||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
|
||||
"read from pipe %d: error(%u): %s", pipe, errno, strerror(errno));
|
||||
"read from pipe %d: error(%u): %s", pipe_fd, errno, strerror(errno));
|
||||
return newly;
|
||||
} else if (bytes[offset] == '\n') {
|
||||
break;
|
||||
|
|
|
@ -81,7 +81,7 @@ sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg);
|
|||
|
||||
/** Read a line from a pipe, similar to fgets. Non-blocking. */
|
||||
extern int
|
||||
sync_pipe_gets_nonblock(int pipe, char *bytes, int max);
|
||||
sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max);
|
||||
|
||||
|
||||
#endif /* capture_sync.h */
|
||||
|
|
Loading…
Reference in New Issue