apps: make memeater use strerror()
This commit is contained in:
parent
8f0b6d80b2
commit
21e8ea1486
@ -1,6 +1,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define CHUNK 4194304 // 4 MB
|
||||
@ -14,6 +15,6 @@ int main()
|
||||
printf("Allocating 4 MB of memory... %lx\n", (unsigned long)allocated);
|
||||
sleep(1);
|
||||
} while ((allocated = malloc(CHUNK)));
|
||||
printf("Out of memory. (errno=%d)\n", errno);
|
||||
printf("Out of memory. (errno=%d, %s)\n", errno, strerror(errno));
|
||||
printf("Press any key to restart.\n");
|
||||
}
|
Loading…
Reference in New Issue
Block a user