version 1.94, 2023/02/09 09:54:11 |
version 1.95, 2023/02/21 06:48:18 |
|
|
const struct sshkey *key, int store_hash) |
const struct sshkey *key, int store_hash) |
{ |
{ |
FILE *f; |
FILE *f; |
int success; |
int success, addnl = 0; |
|
|
if (key == NULL) |
if (key == NULL) |
return 1; /* XXX ? */ |
return 1; /* XXX ? */ |
|
|
return 0; |
return 0; |
/* Make sure we have a terminating newline. */ |
/* Make sure we have a terminating newline. */ |
if (fseek(f, -1L, SEEK_END) == 0 && fgetc(f) != '\n') |
if (fseek(f, -1L, SEEK_END) == 0 && fgetc(f) != '\n') |
if (fputc('\n', f) != '\n') { |
addnl = 1; |
error("Failed to add terminating newline to %s: %s", |
if (fseek(f, 0L, SEEK_END) != 0 || (addnl && fputc('\n', f) != '\n')) { |
filename, strerror(errno)); |
error("Failed to add terminating newline to %s: %s", |
fclose(f); |
filename, strerror(errno)); |
return 0; |
fclose(f); |
} |
return 0; |
|
} |
success = write_host_entry(f, host, NULL, key, store_hash); |
success = write_host_entry(f, host, NULL, key, store_hash); |
fclose(f); |
fclose(f); |
return success; |
return success; |