Skip to content

Commit

Permalink
[loader] Exit if execv failed (#2983)
Browse files Browse the repository at this point in the history
* Exit if execv failed

* Log execv error
  • Loading branch information
iamluc authored Dec 6, 2024
1 parent 34baa56 commit 196c7f2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions loader/dd_library_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <php.h>
#include <php_ini.h>
#include <stdbool.h>
#include <errno.h>
#include <main/SAPI.h>
#include <ext/standard/basic_functions.h>

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

char *argv[] = {telemetry_forwarder_path, "library_entrypoint", payload, NULL};
if (execv(telemetry_forwarder_path, argv)) {
LOG(ERROR, "Telemetry: cannot execv")
}

execv(telemetry_forwarder_path, argv);
LOG(ERROR, "Telemetry: cannot execv: %s", strerror(errno))

// If execv failed, exit immediately
// Return 127 for the most likely case of a missing file
exit(127);
}

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

0 comments on commit 196c7f2

Please sign in to comment.