Skip to content

Commit

Permalink
select, poll, xpoll: fix compilation warnings
Browse files Browse the repository at this point in the history
Like this:

-----
network/select.c:123:60: warning: pointer targets in passing argument 5 of 'getsockopt' differ in signedness [-Wpointer-sign]
  123 |              getsockopt( fd, SOL_SOCKET, SO_TYPE, &optval, &optlen ) == 0 )
      |                                                            ^~~~~~~
      |                                                            |
      |                                                            int *
-----
  • Loading branch information
komh committed Jul 7, 2024
1 parent 4cf442a commit 04ed27d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion network/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@
#include <sys/socket.h>
#include <sys/stat.h>

#include "socklen_t.h"

#include "poll.h"

static int checkfd( int fd )
{
struct stat st;
ULONG ulState;
int optval, optlen = sizeof( optval );
int optval;
socklen_t optlen = sizeof( optval );

/* invalid handle */
if( fstat( fd, &st ) == -1 )
Expand Down
5 changes: 4 additions & 1 deletion network/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <sys/select.h>
#include <sys/stat.h>

#include "socklen_t.h"

/* alias */
int _std_select( int, fd_set *, fd_set *, fd_set *, struct timeval * );

Expand Down Expand Up @@ -97,7 +99,8 @@ static int setfd( int fd, PSELECTPARM parms, int op )
ULONG ulType, ulAttr;
#endif
ULONG ulState;
int optval, optlen = sizeof( optval );
int optval;
socklen_t optlen = sizeof( optval );
int type;

if( fstat( fd, &st ) == -1 )
Expand Down
4 changes: 3 additions & 1 deletion network/xpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <sys/stat.h>
#include <sys/socket.h>

#include "socklen_t.h"

#include "xpoll.h"

struct os2compat_xpollset
Expand Down Expand Up @@ -103,7 +105,7 @@ static int check_fd( int fd )
struct stat st;
ULONG ulState;
int optval;
int optlen = sizeof( optval );
socklen_t optlen = sizeof( optval );

/* accept negative fd, but do nothing for it like poll() */
if( fd < 0 )
Expand Down

0 comments on commit 04ed27d

Please sign in to comment.