Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/libbb/error_msg_and_die.c

    r821 r1765  
    88 */
    99
    10 #include <stdio.h>
    11 #include <errno.h>
    12 #include <string.h>
    13 #include <stdlib.h>
    1410#include "libbb.h"
     11
     12int die_sleep;
     13#if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH
     14jmp_buf die_jmp;
     15#endif
     16
     17void xfunc_die(void)
     18{
     19    if (die_sleep) {
     20        if ((ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH)
     21         && die_sleep < 0
     22        ) {
     23            /* Special case. We arrive here if NOFORK applet
     24             * calls xfunc, which then decides to die.
     25             * We don't die, but jump instead back to caller.
     26             * NOFORK applets still cannot carelessly call xfuncs:
     27             * p = xmalloc(10);
     28             * q = xmalloc(10); // BUG! if this dies, we leak p!
     29             */
     30            /* -2222 means "zero" (longjmp can't pass 0)
     31             * run_nofork_applet() catches -2222. */
     32            longjmp(die_jmp, xfunc_error_retval ? xfunc_error_retval : -2222);
     33        }
     34        sleep(die_sleep);
     35    }
     36    exit(xfunc_error_retval);
     37}
    1538
    1639void bb_error_msg_and_die(const char *s, ...)
     
    1942
    2043    va_start(p, s);
    21     bb_verror_msg(s, p);
     44    bb_verror_msg(s, p, NULL);
    2245    va_end(p);
    23     putc('\n', stderr);
    24     exit(bb_default_error_retval);
     46    xfunc_die();
    2547}
Note: See TracChangeset for help on using the changeset viewer.