Fix file descriptor leakage when closing PPP recording
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 13 Apr 2010 00:33:44 +0000 (17:33 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 13 Apr 2010 00:34:24 +0000 (17:34 -0700)
gatchat/gatppp.c

index b98ab14..259fdeb 100644 (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;