boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

malloc-brk-check.after (412B)


      1   /* Linux's raw brk(2) doesn't return -1 on failure; it returns the
      2    * unchanged break (i.e. < requested). Compare against the requested
      3    * address so a refused growth surfaces as malloc returning NULL
      4    * instead of silently handing out a pointer past the break. */
      5   long _new = (long) (__brk + size);
      6   if (brk (__brk + size) < _new)
      7     return 0;
      8   char *p = __brk;
      9   __brk = __brk + size;
     10   return p;