[En-Nut-Discussion] PPP - Should NutPPPClose() also close the uart device?

Brett Abbott Brett.Abbott at digital-telemetry.com
Tue Oct 24 11:52:02 CEST 2006


Hi

NutPPPOpen starts by opening the uart device using _open() however 
NutPPPClose() does not close the uart device, leaving the uart file lost 
in memory (unless Im meant to delete it elsewhere - oops).

Does anyone have an opinion on how best to address this? Perhaps by 
adding a friendly close prior to the NutHeapFree(fp) in NutPppClose?

Many Thanks in advance
Brett

static int NutPppClose(NUTFILE * fp)
{
    PPPDCB *dcb = fp->nf_dev->dev_dcb;

    IpcpClose(fp->nf_dev);
    if (dcb->dcb_user)
        NutHeapFree(dcb->dcb_user);
    if (dcb->dcb_pass)
        NutHeapFree(dcb->dcb_pass);

    // Add _close of uart?
    if(dcb->dcb_fd)
        _close(dcb->dcb_fd); // Added This line to close uart device?
    // End of change

   NutHeapFree(fp);

    return 0;
}

-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------





More information about the En-Nut-Discussion mailing list