Fix file descriptor leakage when closing PPP recording

This commit is contained in:
Marcel Holtmann 2010-04-12 17:33:44 -07:00
parent 313eb4f285
commit 0e178517ce
1 changed files with 3 additions and 1 deletions

View File

@ -536,8 +536,10 @@ void g_at_ppp_set_recording(GAtPPP *ppp, const char *filename)
if (ppp == NULL)
return;
if (ppp->record_fd > fileno(stderr))
if (ppp->record_fd > fileno(stderr)) {
close(ppp->record_fd);
ppp->record_fd = -1;
}
if (filename == NULL)
return;