Skip to content

Commit

Permalink
2.10b
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-huet committed May 21, 2016
1 parent 501dff4 commit da8cf6f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

PROGNAME = afl
VERSION = 2.09b
VERSION = 2.10b

PREFIX ?= /usr/local
BIN_PATH = $(PREFIX)/bin
Expand Down
23 changes: 14 additions & 9 deletions afl-fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -7133,19 +7133,24 @@ static void get_core_count(void) {

#else

/* On Linux, a simple way is to look at /proc/stat, especially since we'd
be parsing it anyway for other reasons later on. */
if (!cpu_core_count) {

FILE* f = fopen("/proc/stat", "r");
u8 tmp[1024];
/* On Linux, a simple way is to look at /proc/stat, especially since we'd
be parsing it anyway for other reasons later on. But do this only if
cpu_core_count hasn't been obtained before as a result of specifying
-Z. */

if (!f) return;
FILE* f = fopen("/proc/stat", "r");
u8 tmp[1024];

while (fgets(tmp, sizeof(tmp), f))
if (!strncmp(tmp, "cpu", 3) && isdigit(tmp[3])) cpu_core_count++;
if (!f) return;

while (fgets(tmp, sizeof(tmp), f))
if (!strncmp(tmp, "cpu", 3) && isdigit(tmp[3])) cpu_core_count++;

fclose(f);
}

fclose(f);

#endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */

if (cpu_core_count) {
Expand Down
6 changes: 6 additions & 0 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Not sure if you should upgrade? The lowest currently recommended version
is 2.07b. If you're stuck on an earlier release, it's strongly advisable
to get on with the times.

--------------
Version 2.10b:
--------------

- Fixed a minor core counting glitch, reported by Tyler Nighswander.

--------------
Version 2.09b:
--------------
Expand Down

0 comments on commit da8cf6f

Please sign in to comment.