R_SYS_DEVNULL: null device name (#10233)

This commit is contained in:
Khairul Azhar Kasmiran 2018-05-31 22:32:58 +08:00 committed by radare
parent e6ff3aa11b
commit 7befed4463
3 changed files with 8 additions and 10 deletions

View File

@ -699,11 +699,7 @@ int main(int argc, char **argv, char **envp) {
eprintf ("Failed to close stderr");
return 1;
}
#if __WINDOWS__ && !__CYGWIN__
const char nul[] = "nul";
#else
const char nul[] = "/dev/null";
#endif
const char nul[] = R_SYS_DEVNULL;
int new_stderr = open (nul, O_RDWR);
if (-1 == new_stderr) {
eprintf ("Failed to open %s", nul);

View File

@ -19,11 +19,7 @@ static bool checkExtract() {
}
static bool checkCurl() {
#if __WINDOWS__ && !__CYGWIN__
const char nul[] = "nul";
#else
const char nul[] = "/dev/null";
#endif
const char nul[] = R_SYS_DEVNULL;
if (r_sys_cmdf ("curl --version > %s", nul) != 0) {
return false;
}

View File

@ -3,6 +3,12 @@
#include <r_list.h>
#if __WINDOWS__ && !__CYGWIN__
#define R_SYS_DEVNULL "nul"
#else
#define R_SYS_DEVNULL "/dev/null"
#endif
#ifdef __cplusplus
extern "C" {
#endif