mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
options: Fix integer types
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -1095,10 +1095,11 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv)
|
|||||||
int current = 0;
|
int current = 0;
|
||||||
int saveoptind = optind; /* need to save 'em */
|
int saveoptind = optind; /* need to save 'em */
|
||||||
int saveopterr = opterr;
|
int saveopterr = opterr;
|
||||||
|
int opt;
|
||||||
|
|
||||||
opterr = 0; /* shut up getopt */
|
opterr = 0; /* shut up getopt */
|
||||||
while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1)) {
|
while((opt = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1) {
|
||||||
switch(i) {
|
switch(opt) {
|
||||||
case 'l':
|
case 'l':
|
||||||
user = optarg;
|
user = optarg;
|
||||||
break;
|
break;
|
||||||
@@ -1129,8 +1130,8 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
char opt[3]="- ";
|
char optv[3] = "- ";
|
||||||
opt[1] = optopt;
|
optv[1] = optopt;
|
||||||
tmp = realloc(save, (current + 1) * sizeof(char*));
|
tmp = realloc(save, (current + 1) * sizeof(char*));
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
SAFE_FREE(save);
|
SAFE_FREE(save);
|
||||||
@@ -1138,7 +1139,7 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
save = tmp;
|
save = tmp;
|
||||||
save[current] = strdup(opt);
|
save[current] = strdup(optv);
|
||||||
if (save[current] == NULL) {
|
if (save[current] == NULL) {
|
||||||
SAFE_FREE(save);
|
SAFE_FREE(save);
|
||||||
ssh_set_error_oom(session);
|
ssh_set_error_oom(session);
|
||||||
|
|||||||
Reference in New Issue
Block a user