case 'h': // --help
fmt::print(stdout, USAGE_TEXT, MYNAME, MYNAME);
- x_exit(0);
+ exit(EXIT_SUCCESS);
case 'k': // --get-config
fmt::print("{}\n", ctx.config.get_string_value(arg));
case 'V': // --version
fprintf(stdout, VERSION_TEXT, MYNAME, CCACHE_VERSION);
- x_exit(0);
+ exit(EXIT_SUCCESS);
case 'x': // --show-compression
{
default:
fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME);
- x_exit(1);
+ exit(EXIT_FAILURE);
}
// Some of the above switches might have changed config settings, so run the
if (Util::same_program_name(program_name, MYNAME)) {
if (argc < 2) {
fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME);
- x_exit(1);
+ exit(EXIT_FAILURE);
}
// If the first argument isn't an option, then assume we are being passed
// a compiler name and options.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
if (!doreturn) {
- x_exit(exitcode);
+ exit(exitcode);
}
return exitcode;
}
fd_out.close();
dup2(*fd_err, STDERR_FILENO);
fd_err.close();
- x_exit(execv(argv[0], const_cast<char* const*>(argv)));
+ exit(execv(argv[0], const_cast<char* const*>(argv)));
}
fd_out.close();
# include <sys/time.h>
#endif
-// If exit() already has been called, call _exit(), otherwise exit(). This is
-// used to avoid calling exit() inside an atexit handler.
-void
-x_exit(int status)
-{
- static bool first_time = true;
- if (first_time) {
- first_time = false;
- exit(status);
- } else {
- _exit(status);
- }
-}
-
// Rename oldpath to newpath (deleting newpath).
int
x_rename(const char* oldpath, const char* newpath)
#include <string>
-void x_exit(int status) ATTR_NORETURN;
int x_rename(const char* oldpath, const char* newpath);
void set_cloexec_flag(int fd);
double time_seconds();