char argv0_canon[PATH_MAX];
char config_filename_canon[PATH_MAX];
- if (realpath(argv[0], argv0_canon) == NULL) {
+ if (realpath("/proc/self/exe", argv0_canon) == NULL) {
log_perror(argv[0]);
exit(1);
}
if (state_fd != -1) {
log(INFO, "Deserializing state from previous process...");
string serialized;
- if (!read_tempfile(state_fd, &serialized)) {
+ if (!read_tempfile_and_close(state_fd, &serialized)) {
exit(1);
}
if (!loaded_state.ParseFromString(serialized)) {