Ignore:
Timestamp:
Feb 26, 2009, 5:58:49 AM (16 years ago)
Author:
bird
Message:

kash: implementing shfile on top of the win32 api instead of msvcrt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/shinstance.c

    r2287 r2289  
    8080
    8181
    82 typedef struct shmtxtmp { int i; } shmtxtmp;
    83 
    8482int shmtx_init(shmtx *pmtx)
    8583{
     
    160158}
    161159#endif
     160
     161/**
     162 * Destroys the shell instance.
     163 *
     164 * This will work on partially initialized instances (because I'm lazy).
     165 *
     166 * @param   psh     The shell instance to be destroyed.
     167 */
     168static void sh_destroy(shinstance *psh)
     169{
     170    memset(psh, 0, sizeof(*psh));
     171    free(psh);
     172}
    162173
    163174/**
     
    223234    if (psh)
    224235    {
    225         if (!sh_env_clone(&psh->shenviron, envp))
     236        /* Init it enought for sh_destroy() to not get upset */
     237          /* ... */
     238
     239        /* Call the basic initializers. */
     240        if (    !sh_env_clone(&psh->shenviron, envp)
     241            &&  !shfile_init(&psh->fdtab, inherit ? &inherit->fdtab : NULL))
    226242        {
    227243            /* the special stuff. */
     
    282298        }
    283299
    284         free(psh);
     300        sh_destroy(psh);
    285301    }
    286302    return NULL;
Note: See TracChangeset for help on using the changeset viewer.