Browse Source

The ntk-console client command console_uptime should now not print negative numbers, And inet_sendto should now properly print ipv4 addresses in a human readable format.

MissValeska 9 years ago
parent
commit
8bc5d69758
3 changed files with 17 additions and 17 deletions
  1. 5
    5
      src/inet.c
  2. 6
    6
      src/ntk-console.c
  3. 6
    6
      src/ntk-console.h

+ 5
- 5
src/inet.c View File

@@ -1117,11 +1117,11 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
1117 1117
 						len-(len/2), flags, to, tolen);
1118 1118
 			break;
1119 1119
 		case EFAULT:
1120
-			error("To Family is: %hu "
1121
-                                "To Data is: %%pNP "
1122
-                                "and: %s", to->sa_family, 
1123
-                                to->sa_data,
1124
-                                strerror(errno));
1120
+			error("Bad Address\n"
1121
+                                "To Family is: %hu "
1122
+                                "To Data is: %s", 
1123
+                                to->sa_family, 
1124
+                                inet_ntoa(  &(  ((struct sockaddr_in*)to)->sin_addr ) ));
1125 1125
 		default:
1126 1126
 			error("inet_sendto: Cannot send(): %s", strerror(errno));
1127 1127
 			return err;

+ 6
- 6
src/ntk-console.c View File

@@ -179,13 +179,13 @@ ntkd_request(command_t command)
179 179
 
180 180
 void console_uptime(void) {
181 181
     
182
-    int uptime_sec1;
183
-    int uptime_min1;
184
-    int uptime_hour1;
182
+    unsigned int uptime_sec1;
183
+    unsigned int uptime_min1;
184
+    unsigned int uptime_hour1;
185 185
     
186
-    int uptime_day1;
187
-    int uptime_month1;
188
-    int uptime_year1;
186
+    unsigned int uptime_day1;
187
+    unsigned int uptime_month1;
188
+    unsigned int uptime_year1;
189 189
     
190 190
     time(&rawtime);
191 191
     

+ 6
- 6
src/ntk-console.h View File

@@ -31,12 +31,12 @@ int rc, bytesReceived;
31 31
 time_t rawtime;
32 32
 struct tm *timeinfo;
33 33
 
34
-int uptime_sec;
35
-int uptime_min;
36
-int uptime_hour;
37
-int uptime_day;
38
-int uptime_month;
39
-int uptime_year;
34
+unsigned int uptime_sec;
35
+unsigned int uptime_min;
36
+unsigned int uptime_hour;
37
+unsigned int uptime_day;
38
+unsigned int uptime_month;
39
+unsigned int uptime_year;
40 40
 
41 41
 int i;
42 42
 

Loading…
Cancel
Save