config: Reformat local_parse_file

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2018-12-05 11:40:44 +01:00
committed by Andreas Schneider
parent 993e24a361
commit 8f887e82c7

View File

@@ -323,14 +323,19 @@ static int ssh_config_get_yesno(char **str, int notfound) {
return notfound; return notfound;
} }
static void local_parse_file(ssh_session session, const char *filename, static void
int *parsing, uint8_t *seen) local_parse_file(ssh_session session,
const char *filename,
int *parsing,
uint8_t *seen)
{ {
FILE *f; FILE *f;
char line[MAX_LINE_SIZE] = {0}; char line[MAX_LINE_SIZE] = {0};
unsigned int count = 0; unsigned int count = 0;
int rv;
if ((f = fopen(filename, "r")) == NULL) { f = fopen(filename, "r");
if (f == NULL) {
SSH_LOG(SSH_LOG_RARE, "Cannot find file %s to load", SSH_LOG(SSH_LOG_RARE, "Cannot find file %s to load",
filename); filename);
return; return;
@@ -339,7 +344,8 @@ static void local_parse_file(ssh_session session, const char *filename,
SSH_LOG(SSH_LOG_PACKET, "Reading additional configuration data from %s", filename); SSH_LOG(SSH_LOG_PACKET, "Reading additional configuration data from %s", filename);
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
count++; count++;
if (ssh_config_parse_line(session, line, count, parsing, seen) < 0) { rv = ssh_config_parse_line(session, line, count, parsing, seen);
if (rv < 0) {
fclose(f); fclose(f);
return; return;
} }