[pisa-src] r1318 - in trunk/pairing: create_send_headers.c packet_handler_accept.c packet_handler_send.c send.c
- From: Thomas Jansen <mithi@xxxxxxxxx>
- To: pisa-src@xxxxxxxxxxxxx
- Date: Tue, 27 Oct 2009 14:56:47 +0100
Author: tjansen
Date: Tue Oct 27 14:56:47 2009
New Revision: 1318
Log:
Fixed warnings in pairing subdirectory:
send.c: In function ‘open_socket_send’:
send.c:361: warning: ignoring return value of ‘system’, declared with attribute
warn_unused_result
packet_handler_send.c: In function ‘store_relay_info’:
packet_handler_send.c:108: warning: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
create_send_headers.c: In function ‘create_pwd_request_struct’:
create_send_headers.c:79: warning: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
create_send_headers.c:86: warning: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
create_send_headers.c:90: warning: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
packet_handler_accept.c: In function ‘check_password’:
packet_handler_accept.c:158: warning: ignoring return value of ‘fgets’,
declared with attribute warn_unused_result
Modified:
trunk/pairing/create_send_headers.c
trunk/pairing/packet_handler_accept.c
trunk/pairing/packet_handler_send.c
trunk/pairing/send.c
Modified: trunk/pairing/create_send_headers.c
==============================================================================
--- trunk/pairing/create_send_headers.c Tue Oct 27 14:41:58 2009 (r1317)
+++ trunk/pairing/create_send_headers.c Tue Oct 27 14:56:47 2009 (r1318)
@@ -76,18 +76,21 @@
USER_MSG("Invalid nickname. Nicknames may only
contain letters and numbers.");
USER_MSG("Please enter a nickname
(alphanumeric characters only).");
}
- fgets(nickname, LENGTH_NICKNAME, stdin);
+ if (!fgets(nickname, LENGTH_NICKNAME, stdin))
+ return NULL;
nickname[strlen(nickname)-1] = 0;
}
while (!(valid = valid_nickname(nickname)));
// Get expiration times
USER_MSG("When should the password expire? Date format:
dd-mm-yyyy hh:mm:ss (24 hour clock).");
- fgets(expiration1, LENGTH_TIMEOUT, stdin);
+ if (!fgets(expiration1, LENGTH_TIMEOUT, stdin))
+ return NULL;
expiration1[strlen(expiration1)-1] = 0;
USER_MSG("When should their access terminate? Date format:
dd-mm-yyyy hh:mm:ss (24 hour clock).");
- fgets(expiration2, LENGTH_TIMEOUT, stdin);
+ if (!fgets(expiration2, LENGTH_TIMEOUT, stdin))
+ return NULL;
expiration2[strlen(expiration2)-1] = 0;
// Convert the first expiration date
Modified: trunk/pairing/packet_handler_accept.c
==============================================================================
--- trunk/pairing/packet_handler_accept.c Tue Oct 27 14:41:58 2009
(r1317)
+++ trunk/pairing/packet_handler_accept.c Tue Oct 27 14:56:47 2009
(r1318)
@@ -155,7 +155,8 @@
}
// Read line
- fgets(file_contents, 2*SHA_DIGEST_LENGTH+1, file);
+ if (!fgets(file_contents, 2*SHA_DIGEST_LENGTH+1, file))
+ return 0;
file_contents[2*SHA_DIGEST_LENGTH] = 0; // Null-terminate the line
DEBUG_MED("File contents:\t\'%s\'", file_contents);
Modified: trunk/pairing/packet_handler_send.c
==============================================================================
--- trunk/pairing/packet_handler_send.c Tue Oct 27 14:41:58 2009 (r1317)
+++ trunk/pairing/packet_handler_send.c Tue Oct 27 14:56:47 2009 (r1318)
@@ -105,7 +105,8 @@
if (!valid)
USER_MSG("Invalid nickname. Nicknames may only
contain letters and numbers.");
USER_MSG("Please enter a nickname for this relay
(suggest: \'%s\'). Nicknames may only contain alphanumeric characters. Leave
blank to skip storing the information.", nickname);
- fgets(new_nickname, LENGTH_NICKNAME, stdin);
+ if (!fgets(new_nickname, LENGTH_NICKNAME, stdin))
+ return 0;
new_nickname[strlen(new_nickname)-1] = 0;
}
while (!(valid = valid_nickname(new_nickname)));
Modified: trunk/pairing/send.c
==============================================================================
--- trunk/pairing/send.c Tue Oct 27 14:41:58 2009 (r1317)
+++ trunk/pairing/send.c Tue Oct 27 14:56:47 2009 (r1318)
@@ -358,7 +358,8 @@
char system_call[2*INET6_ADDRSTRLEN + 256];
snprintf(system_call, sizeof(system_call), "./hipconf add map
%s %s > /dev/null 2>&1", hit, ipv6_addr);
DEBUG_HIGH("System call: %s", system_call);
- system(system_call);
+ if (system(system_call) < 0)
+ DEBUG_HIGH("System call failed");
}
Other related posts:
- » [pisa-src] r1318 - in trunk/pairing: create_send_headers.c packet_handler_accept.c packet_handler_send.c send.c - Thomas Jansen