mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +00:00
log.c: New log_is_debug() function, hide access to debug variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
e9d5512e1a
commit
51e1a907e6
6 files changed
+18
-11
No files matched your search
+3
-3
@@ -171,7 +171,7 @@ int run_interactive(char *cmd, char *fmt, ...)
|
||||
|
||||
/* Redirect output from cmd to a tempfile */
|
||||
fp = tempfile();
|
||||
if (fp && !debug) {
|
||||
if (fp && !log_is_debug()) {
|
||||
oldout = dup(STDOUT_FILENO);
|
||||
olderr = dup(STDERR_FILENO);
|
||||
dup2(fileno(fp), STDOUT_FILENO);
|
||||
@@ -182,7 +182,7 @@ int run_interactive(char *cmd, char *fmt, ...)
|
||||
status = run(cmd);
|
||||
|
||||
/* Restore stderr/stdout */
|
||||
if (fp && !debug) {
|
||||
if (fp && !log_is_debug()) {
|
||||
if (oldout >= 0) {
|
||||
dup2(oldout, STDOUT_FILENO);
|
||||
close(oldout);
|
||||
@@ -197,7 +197,7 @@ int run_interactive(char *cmd, char *fmt, ...)
|
||||
print_result(status);
|
||||
|
||||
/* Dump any results of cmd on stderr after we've printed [ OK ] or [FAIL] */
|
||||
if (fp && !debug) {
|
||||
if (fp && !log_is_debug()) {
|
||||
size_t len, written;
|
||||
|
||||
rewind(fp);
|
||||
|
||||
Reference in new issue
Block a user