Skip to content

Commit 196c7f2

Browse files
authored
[loader] Exit if execv failed (#2983)
* Exit if execv failed * Log execv error
1 parent 34baa56 commit 196c7f2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

loader/dd_library_loader.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <php.h>
99
#include <php_ini.h>
1010
#include <stdbool.h>
11+
#include <errno.h>
1112
#include <main/SAPI.h>
1213
#include <ext/standard/basic_functions.h>
1314

@@ -316,9 +317,13 @@ static void ddloader_telemetryf(telemetry_reason reason, const char *format, ...
316317
snprintf(payload, sizeof(payload), template, runtime_version, runtime_version, tracer_version, loader_pid, points);
317318

318319
char *argv[] = {telemetry_forwarder_path, "library_entrypoint", payload, NULL};
319-
if (execv(telemetry_forwarder_path, argv)) {
320-
LOG(ERROR, "Telemetry: cannot execv")
321-
}
320+
321+
execv(telemetry_forwarder_path, argv);
322+
LOG(ERROR, "Telemetry: cannot execv: %s", strerror(errno))
323+
324+
// If execv failed, exit immediately
325+
// Return 127 for the most likely case of a missing file
326+
exit(127);
322327
}
323328

324329
static char *ddloader_find_ext_path(const char *ext_dir, const char *ext_name, int module_api, bool is_zts, bool is_debug) {

0 commit comments

Comments
 (0)