1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-12 21:46:01 +01:00

nix-find-roots: Don't assume that argv[0] exists

This commit is contained in:
Théophane Hufschmitt 2023-06-26 09:01:06 +02:00
parent 65387ad3ea
commit c4ca0d45cb

View file

@ -23,7 +23,8 @@ TracerConfig parseCmdLine(int argc, char** argv)
fs::path socketPath = "/nix/var/nix/gc-trace-socket/socket";
auto usage = [&]() {
std::cerr << "Usage: " << string(argv[0]) << " [--verbose|-v] [-s storeDir] [-d stateDir] [-l socketPath]" << std::endl;
std::string programName = argc > 0 ? argv[0] : "nix-find-roots";
std::cerr << "Usage: " << programName << " [--verbose|-v] [-s storeDir] [-d stateDir] [-l socketPath]" << std::endl;
exit(1);
};
static struct option long_options[] = {