Skip to content

Commit

Permalink
Fix compilation on linux introduced by macos __write_nocancel
Browse files Browse the repository at this point in the history
  • Loading branch information
cehoffman committed Apr 28, 2021
1 parent 349406e commit b2238f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/stderred.c
Expand Up @@ -384,24 +384,24 @@ void FUNC(warnx)(const char *fmt, ...) {
va_end(ap);
}

user_ssize_t __write_nocancel(int fd, user_addr_t cbuf, user_size_t nbyte);

#ifdef HAVE__WRITE_NOCANCEL
user_ssize_t FUNC(__write_nocancel)(int fd, user_addr_t cbuf, user_size_t nbyte) {
ssize_t __write_nocancel(int fd, const void * cbuf, size_t nbyte);

ssize_t FUNC(__write_nocancel)(int fd, const void * cbuf, size_t nbyte) {
if (nbyte == 0) return 0;

user_ssize_t result;
ssize_t result;

GET_ORIGINAL(user_ssize_t, __write_nocancel, int, user_addr_t, user_size_t);
GET_ORIGINAL(ssize_t, __write_nocancel, int, const void *, size_t);

if (COLORIZE(fd)) {
result = ORIGINAL(__write_nocancel)(fd, (user_addr_t)start_color_code, start_color_code_size);
result = ORIGINAL(__write_nocancel)(fd, (const void *)start_color_code, start_color_code_size);
if (result < 0) return result;
}

result = ORIGINAL(__write_nocancel)(fd, cbuf, nbyte);
if (result > 0 && COLORIZE(fd)) {
ORIGINAL(__write_nocancel)(fd, (user_addr_t)end_color_code, end_color_code_size);
ORIGINAL(__write_nocancel)(fd, (const void *)end_color_code, end_color_code_size);
}

return result;
Expand Down

0 comments on commit b2238f7

Please sign in to comment.