Skip to content

Commit 25563f3

Browse files
committed
Fixed warning
1 parent f7c2193 commit 25563f3

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

edge.c

+17-16
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ static void help() {
171171

172172
/* *************************************************** */
173173

174-
static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee) {
174+
static int setOption(int optkey, char *optargument, edge_conf_t *ec, n2n_edge_t *eee) {
175175

176-
//traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, optarg ? optarg : "");
176+
//traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, optargument ? optargument : "");
177177

178178
switch(optkey) {
179179
case'K':
@@ -182,7 +182,7 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
182182
fprintf(stderr, "Error: -K and -k options are mutually exclusive.\n");
183183
exit(1);
184184
} else {
185-
strncpy(eee->keyschedule, optarg, N2N_PATHNAME_MAXLEN-1);
185+
strncpy(eee->keyschedule, optargument, N2N_PATHNAME_MAXLEN-1);
186186
/* strncpy does not add NULL if the source has no NULL. */
187187
eee->keyschedule[N2N_PATHNAME_MAXLEN-1] = 0;
188188

@@ -196,14 +196,14 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
196196
{
197197
scan_address(ec->ip_addr, N2N_NETMASK_STR_SIZE,
198198
ec->ip_mode, N2N_IF_MODE_SIZE,
199-
optarg);
199+
optargument);
200200
break;
201201
}
202202

203203
case 'c': /* community as a string */
204204
{
205205
memset(eee->community_name, 0, N2N_COMMUNITY_SIZE);
206-
strncpy((char *)eee->community_name, optarg, N2N_COMMUNITY_SIZE);
206+
strncpy((char *)eee->community_name, optargument, N2N_COMMUNITY_SIZE);
207207
break;
208208
}
209209

@@ -217,13 +217,13 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
217217
#ifndef WIN32
218218
case 'u': /* unprivileged uid */
219219
{
220-
ec->userid = atoi(optarg);
220+
ec->userid = atoi(optargument);
221221
break;
222222
}
223223

224224
case 'g': /* unprivileged uid */
225225
{
226-
ec->groupid = atoi(optarg);
226+
ec->groupid = atoi(optargument);
227227
break;
228228
}
229229
#endif
@@ -238,13 +238,13 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
238238

239239
case 'm' : /* TUNTAP MAC address */
240240
{
241-
strncpy(ec->device_mac,optarg,N2N_MACNAMSIZ);
241+
strncpy(ec->device_mac,optargument,N2N_MACNAMSIZ);
242242
break;
243243
}
244244

245245
case 'M' : /* TUNTAP MTU */
246246
{
247-
ec->mtu = atoi(optarg);
247+
ec->mtu = atoi(optargument);
248248
break;
249249
}
250250

@@ -255,7 +255,7 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
255255
exit(1);
256256
} else {
257257
traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", ec->encrypt_key);
258-
ec->encrypt_key = strdup(optarg);
258+
ec->encrypt_key = strdup(optargument);
259259
}
260260
break;
261261
}
@@ -269,8 +269,9 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
269269
case 'l': /* supernode-list */
270270
{
271271
if(eee->sn_num < N2N_EDGE_NUM_SUPERNODES) {
272-
strncpy((eee->sn_ip_array[eee->sn_num]), optarg, N2N_EDGE_SN_HOST_SIZE);
273-
traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n", (unsigned int)eee->sn_num, (eee->sn_ip_array[eee->sn_num]));
272+
strncpy((eee->sn_ip_array[eee->sn_num]), optargument, N2N_EDGE_SN_HOST_SIZE);
273+
traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n",
274+
(unsigned int)eee->sn_num, (eee->sn_ip_array[eee->sn_num]));
274275
++eee->sn_num;
275276
} else {
276277
fprintf(stderr, "Too many supernodes!\n");
@@ -282,7 +283,7 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
282283
#if defined(N2N_CAN_NAME_IFACE)
283284
case 'd': /* TUNTAP name */
284285
{
285-
strncpy(ec->tuntap_dev_name, optarg, N2N_IFNAMSIZ);
286+
strncpy(ec->tuntap_dev_name, optargument, N2N_IFNAMSIZ);
286287
break;
287288
}
288289
#endif
@@ -295,13 +296,13 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
295296

296297
case 'p':
297298
{
298-
ec->local_port = atoi(optarg);
299+
ec->local_port = atoi(optargument);
299300
break;
300301
}
301302

302303
case 't':
303304
{
304-
ec->mgmt_port = atoi(optarg);
305+
ec->mgmt_port = atoi(optargument);
305306
break;
306307
}
307308

@@ -310,7 +311,7 @@ static int setOption(int optkey, char *optarg, edge_conf_t *ec, n2n_edge_t *eee)
310311
if(0 != ec->got_s) {
311312
traceEvent(TRACE_WARNING, "Multiple subnet masks supplied.");
312313
}
313-
strncpy(ec->netmask, optarg, N2N_NETMASK_STR_SIZE);
314+
strncpy(ec->netmask, optargument, N2N_NETMASK_STR_SIZE);
314315
ec->got_s = 1;
315316
break;
316317
}

0 commit comments

Comments
 (0)