Skip to content

Commit 355dddb

Browse files
committed
fix warnings
1 parent 98aeac2 commit 355dddb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
language: r
44
cache: packages
55
sudo: false
6-
warnings_are_errors: false
76
r_build_args: --no-build-vignettes
87
r_check_args: --no-build-vignettes --no-manual --timings
98
r:

src/sub-linux.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ static void exit_on_failure ()
6060

6161
// it's hard to imagine a situation where this symbol would not be
6262
// present; regardless, we cause a SEGMENTATION error because the
63-
// child needs to die
63+
// child needs to die;
64+
// also, we use write because CRAN will warn about fprintf(stderr)
6465
if (!exit_handle) {
65-
fprintf(stderr, "could not dlopen() the exit() function, going to SEGFAULT\n");
66+
const char * message = "could not dlopen() the exit() function, going to SEGFAULT\n";
67+
write(STDERR_FILENO, message, strlen(message));
6668
*(int*)exit_handle = 0;
6769
}
6870

@@ -126,15 +128,15 @@ int spawn_process (process_handle_t * _handle, const char * _command, char *cons
126128
if (_handle->child_id == 0) {
127129
if (dup2(pipe_stdin[PIPE_READ], STDIN_FILENO) < 0) {
128130
perror("redirecting stdin failed, abortnig");
129-
exit(EXIT_FAILURE);
131+
exit_on_failure();
130132
}
131133
if (dup2(pipe_stdout[PIPE_WRITE], STDOUT_FILENO) < 0) {
132134
perror("redirecting stdout failed, abortnig");
133-
exit(EXIT_FAILURE);
135+
exit_on_failure();
134136
}
135137
if (dup2(pipe_stderr[PIPE_WRITE], STDERR_FILENO) < 0) {
136138
perror("redirecting stderr failed, abortnig");
137-
exit(EXIT_FAILURE);
139+
exit_on_failure();
138140
}
139141

140142
/* redirection succeeded, now close all other descriptors */

0 commit comments

Comments
 (0)