Commit Diff


commit - 2fd1d0d9309265087d1e1ade81ccda8b3563f81a
commit + 97e8ac98ec05056115fe60344bce713996dd528e
blob - fa81b459246d6b7ef410c200b670f49dda28da33
blob + 84888ce2335d926156e88f474871fe5ee84dd82a
--- luzer/afl-lua.c
+++ luzer/afl-lua.c
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: MIT
  *
  * Copyright © 2020, Steven Johnstone
- *             2022-2024, Sergey Bronnikov
+ *             2022-2025, Sergey Bronnikov
  */
 
 #include <assert.h>
@@ -25,9 +25,9 @@
 
 /*
  * We will communicate with the AFL forkserver over two pipes with
- * file descriptors of 198 and 199 (these values are hardcoded by
- * AFL). AFL specifies that the 198 pipe is for reading data from
- * the forkserver, and 199 is for writing to it.
+ * file descriptors equal to 198 and 199 (these values are
+ * hardcoded by AFL). AFL specifies that the 198 pipe is for
+ * reading data from the forkserver, and 199 is for writing to it.
  */
 #define FORKSRV_FD 198
 
@@ -120,13 +120,13 @@ debug_hook(lua_State *L, lua_Debug *ar) {
 int
 main(int argc, const char **argv) {
 	if (argc == 1) {
-		fprintf(stderr, "Missed arguments.\n");
+		fprintf(stderr, "afl-lua: missed arguments.\n");
 		exit(EXIT_FAILURE);
 	}
 
 	int rc = shm_init();
 	if (rc != 0) {
-		fprintf(stderr, "shm_init() failed.\n");
+		fprintf(stderr, "afl-lua: shm_init() failed.\n");
 		exit(EXIT_FAILURE);
 	}
 
@@ -134,13 +134,13 @@ main(int argc, const char **argv) {
 
 	const char *script_path = argv[1];
 	if (access(script_path, F_OK) != 0) {
-		fprintf(stderr, "File (%s) does not exist.\n", script_path);
+		fprintf(stderr, "afl-lua: file (%s) does not exist.\n", script_path);
 		exit(EXIT_FAILURE);
 	}
 
 	lua_State *L = luaL_newstate();
 	if (L == NULL) {
-		fprintf(stderr, "Lua initialization failed.\n");
+		fprintf(stderr, "afl-lua: Lua initialization failed.\n");
 		exit(EXIT_FAILURE);
 	}
 	luaL_openlibs(L);
@@ -150,7 +150,7 @@ main(int argc, const char **argv) {
 		rc = luaL_dofile(L, script_path);
 		if (rc != 0) {
 			const char *err_str = lua_tostring(L, 1);
-			fprintf(stderr, "NOFORK luaL_dofile(): %s\n", err_str);
+			fprintf(stderr, "afl-lua: %s\n", err_str);
 			lua_pop(L, 1);
 			exit(EXIT_FAILURE);
 		}
@@ -168,8 +168,8 @@ main(int argc, const char **argv) {
 			rc = luaL_dofile(L, script_path);
 			if (rc != 0) {
 				const char *err_str = lua_tostring(L, 1);
+				fprintf(stderr, "afl-lua: %s\n", err_str);
 				lua_pop(L, 1);
-				fprintf(stderr, "luaL_dofile(): %s\n", err_str);
 				abort();
 			}
 			return EXIT_SUCCESS;
@@ -178,7 +178,7 @@ main(int argc, const char **argv) {
 		int status = 0;
 		rc = wait(&status);
 		if (rc == -1) {
-			fprintf(stderr, "wait() failed.\n");
+			perror("afl-lua");
 			abort();
 		}
 		fork_write(status);
blob - 855e4b7efe64dbd886a59f442f789391901bd00e
blob + 5888e043d8f194291750cfdaa80e8d0b87330741
--- luzer/tests/CMakeLists.txt
+++ luzer/tests/CMakeLists.txt
@@ -12,7 +12,6 @@ make_lua_path(LUA_PATH
   ${PROJECT_SOURCE_DIR}/?/?.lua
   ${PROJECT_SOURCE_DIR}/?/init.lua
 )
-# set(LUA_CPATH "\;${PROJECT_BINARY_DIR}/luzer/?.so\;")
 set(AFL_LUA_BIN $<TARGET_FILE:${AFL_LUA}>)
 
 set(AFL_IN_DIR ${CMAKE_CURRENT_BINARY_DIR}/afl_input_dir)