summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-05-02 03:38:57 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-05-02 03:38:57 +0000
commit00aa5613f7aaa85676d3f549ec6b71d9adf3b4b8 (patch)
tree418bd2bf08abde8f1e8466a4255e4bb3b64e9e30 /src
parent0e58e4d8048d29b0507116d3206a184e7e71e3d3 (diff)
downloadhercules-00aa5613f7aaa85676d3f549ec6b71d9adf3b4b8.tar.gz
hercules-00aa5613f7aaa85676d3f549ec6b71d9adf3b4b8.tar.bz2
hercules-00aa5613f7aaa85676d3f549ec6b71d9adf3b4b8.tar.xz
hercules-00aa5613f7aaa85676d3f549ec6b71d9adf3b4b8.zip
Fixed the last buildbot warnings throughout multiple platforms, from console plugin (which should be purged rather than fixed imo :|)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16039 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/plugins/console.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/plugins/console.c b/src/plugins/console.c
index 673a30e78..fc883a9f3 100644
--- a/src/plugins/console.c
+++ b/src/plugins/console.c
@@ -273,31 +273,27 @@ int input_final(void)
#define input_getstate() buf.state
/// Sets the state of the input
-void input_setstate(char state)
-{
- if( state == INPUT_READY && input_getstate() == INPUT_READING )
- {// send data from the worker to the main process
- write(buf.data_pipe[PIPE_WRITE], &buf.len, sizeof(buf.len));
- write(buf.data_pipe[PIPE_WRITE], &buf.arr, buf.len);
- } else if( state == INPUT_WAITING ){
- if( buf.close_unused_flag == 0 )
- {// close unused pipe sides in the main process
+void input_setstate(char state) {
+ size_t fileReadCount = 0;
+ if( state == INPUT_READY && input_getstate() == INPUT_READING ) {// send data from the worker to the main process
+ fileReadCount = write(buf.data_pipe[PIPE_WRITE], &buf.len, sizeof(buf.len));
+ fileReadCount = write(buf.data_pipe[PIPE_WRITE], &buf.arr, buf.len);
+ } else if( state == INPUT_WAITING ) {
+ if( buf.close_unused_flag == 0 ) {// close unused pipe sides in the main process
close(buf.data_pipe[PIPE_WRITE]);
close(buf.state_pipe[PIPE_READ]);
buf.close_unused_flag = 1;
}
// send the next state
- write(buf.state_pipe[PIPE_WRITE], &state, sizeof(state));
- } else if( state == INPUT_READING ){
- if( buf.close_unused_flag == 0 )
- {// close unused pipe sides in the worker process
+ fileReadCount = write(buf.state_pipe[PIPE_WRITE], &state, sizeof(state));
+ } else if( state == INPUT_READING ) {
+ if( buf.close_unused_flag == 0 ) {// close unused pipe sides in the worker process
close(buf.data_pipe[PIPE_READ]);
close(buf.state_pipe[PIPE_WRITE]);
buf.close_unused_flag = 1;
}
- } else if( state == INPUT_CLOSED )
- {// send next state to the worker and close the pipes
- write(buf.state_pipe[PIPE_WRITE], &state, sizeof(state));
+ } else if( state == INPUT_CLOSED ) {// send next state to the worker and close the pipes
+ fileReadCount = write(buf.state_pipe[PIPE_WRITE], &state, sizeof(state));
close(buf.data_pipe[PIPE_WRITE]);
close(buf.data_pipe[PIPE_READ]);
close(buf.state_pipe[PIPE_WRITE]);
@@ -327,9 +323,10 @@ int input_hasdata()
{
struct pollfd fds;
int hasData;
-
- if( input_getstate() == INPUT_READY )
- {// start getting data
+ size_t fileReadCount;
+
+
+ if( input_getstate() == INPUT_READY ) {// start getting data
input_setstate(INPUT_WAITING);
return 0;
}
@@ -337,10 +334,9 @@ int input_hasdata()
fds.fd = buf.data_pipe[PIPE_READ];
fds.events = POLLRDNORM;
hasData = ( poll(&fds,1,0) > 0 );
- if( hasData )
- {// read the data from the pipe
- read(buf.data_pipe[PIPE_READ], &buf.len, sizeof(buf.len));
- read(buf.data_pipe[PIPE_READ], buf.arr, buf.len);
+ if( hasData ) {// read the data from the pipe
+ fileReadCount = read(buf.data_pipe[PIPE_READ], &buf.len, sizeof(buf.len));
+ fileReadCount = read(buf.data_pipe[PIPE_READ], buf.arr, buf.len);
input_setstate(INPUT_READY);
}
@@ -405,8 +401,8 @@ WORKER_FUNC_START(getinput)
{// get input
input_setstate(INPUT_READING);
buf.arr[0] = '\0';
- fgets(buf.arr, INPUT_BUFSIZE, stdin);
- buf.len = strlen(buf.arr);
+ if( fgets(buf.arr, INPUT_BUFSIZE, stdin) != NULL )
+ buf.len = strlen(buf.arr);
input_setstate(INPUT_READY);
}
WORKER_FUNC_END(getinput)