Error checking and marking in preserve_static_entr
Appends "# rhosts begin\n" after static entries Cleanly errors out if failes to write to tmp filestable
parent
8c377d6234
commit
66251c6c2a
11
src/rhosts.c
11
src/rhosts.c
|
|
@ -136,10 +136,21 @@ int preserve_static_entries(){
|
|||
if (strncmp(buff, "# rhosts begin", 14) == 0){c = EOF;}
|
||||
if (c == '\n'){
|
||||
rc = fputs(buff, tmpf);
|
||||
if (rc == EOF){
|
||||
fclose(hostsf);
|
||||
fclose(tmpf);
|
||||
return 1;
|
||||
}
|
||||
printf("%s",buff);
|
||||
buff[0] = '\0';
|
||||
}
|
||||
}while ( c != EOF);
|
||||
rc = fputs("# rhosts begin\n", tmpf);
|
||||
if (rc == EOF){
|
||||
fclose(hostsf);
|
||||
fclose(tmpf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue