Fix some compiler warnings

This commit is contained in:
Dave Davenport 2015-10-19 09:23:06 +02:00
parent 1b425c7bd0
commit 64cb4c781c
5 changed files with 28 additions and 13 deletions

View File

@ -124,6 +124,9 @@ static void parse_pair ( char *input, struct range_pair *item )
static void parse_ranges ( char *input, struct range_pair **list, unsigned int *length )
{
char *endp;
if ( input == NULL ) {
return;
}
for ( char *token = strtok_r ( input, ",", &endp ); token != NULL; token = strtok_r ( NULL, ",", &endp ) ) {
// Make space.
*list = g_realloc ( ( *list ), ( ( *length ) + 1 ) * sizeof ( struct range_pair ) );

View File

@ -1877,13 +1877,22 @@ static gpointer rofi_signal_handler_process ( gpointer arg )
else {
// Send message to main thread.
if ( sig == SIGHUP ) {
write ( pfd, "c", 1 );
ssize_t t = write ( pfd, "c", 1 );
if ( t < 0 ) {
fprintf ( stderr, "Failed to send signal to main thread.\n" );
}
}
if ( sig == SIGUSR1 ) {
write ( pfd, "i", 1 );
ssize_t t = write ( pfd, "i", 1 );
if ( t < 0 ) {
fprintf ( stderr, "Failed to send signal to main thread.\n" );
}
}
else if ( sig == SIGINT ) {
write ( pfd, "q", 1 );
ssize_t t = write ( pfd, "q", 1 );
if ( t < 0 ) {
fprintf ( stderr, "Failed to send signal to main thread.\n" );
}
// Close my end and exit.
g_thread_exit ( NULL );
}
@ -2191,9 +2200,12 @@ int main ( int argc, char *argv[] )
if ( FD_ISSET ( pfds[0], &in_fds ) ) {
// The signal thread send us a message. Process it.
char c;
read ( pfds[0], &c, 1 );
ssize_t r = read ( pfds[0], &c, 1 );
if ( r < 0 ) {
fprintf ( stderr, "Failed to read data from signal thread: %s\n", strerror ( errno ) );
}
// Process the signal in the main_loop.
if ( main_loop_signal_handler ( c, quiet ) ) {
else if ( main_loop_signal_handler ( c, quiet ) ) {
break;
}
}