Fixed sftp_parse_longname() on Windows.
There is no strndup function on Windows.
Этот коммит содержится в:
родитель
464176d511
Коммит
8424c7a747
@ -1126,7 +1126,8 @@ enum sftp_longname_field_e {
|
||||
static char *sftp_parse_longname(const char *longname,
|
||||
enum sftp_longname_field_e longname_field) {
|
||||
const char *p, *q;
|
||||
size_t field = 0;
|
||||
size_t len, field = 0;
|
||||
char *x;
|
||||
|
||||
p = longname;
|
||||
/* Find the beginning of the field which is specified by sftp_longanme_field_e. */
|
||||
@ -1147,7 +1148,16 @@ static char *sftp_parse_longname(const char *longname,
|
||||
q++;
|
||||
}
|
||||
|
||||
return strndup(p, q - p);
|
||||
/* There is no strndup on windows */
|
||||
len = q - p + 1;
|
||||
x = malloc(len);
|
||||
if (x == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snprintf(x, len, "%s", p);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/* sftp version 0-3 code. It is different from the v4 */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user