Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/libbb/xfunc_die.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/libbb/xfunc_die.c

    r2725 r3621  
    88 */
    99
    10 /* Keeping it separate allows to NOT suck in stdio for VERY small applets.
     10/* Keeping it separate allows to NOT pull in stdio for VERY small applets.
    1111 * Try building busybox with only "true" enabled... */
    1212
    1313#include "libbb.h"
    1414
    15 int die_sleep;
    16 #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH
    17 jmp_buf die_jmp;
    18 #endif
     15void (*die_func)(void);
    1916
    2017void FAST_FUNC xfunc_die(void)
    2118{
    22     if (die_sleep) {
    23         if ((ENABLE_FEATURE_PREFER_APPLETS || ENABLE_HUSH)
    24          && die_sleep < 0
    25         ) {
    26             /* Special case. We arrive here if NOFORK applet
    27              * calls xfunc, which then decides to die.
    28              * We don't die, but jump instead back to caller.
    29              * NOFORK applets still cannot carelessly call xfuncs:
    30              * p = xmalloc(10);
    31              * q = xmalloc(10); // BUG! if this dies, we leak p!
    32              */
    33             /* -2222 means "zero" (longjmp can't pass 0)
    34              * run_nofork_applet() catches -2222. */
    35             longjmp(die_jmp, xfunc_error_retval ? xfunc_error_retval : -2222);
    36         }
    37         sleep(die_sleep);
    38     }
     19    if (die_func)
     20        die_func();
    3921    exit(xfunc_error_retval);
    4022}
Note: See TracChangeset for help on using the changeset viewer.