Did it like this:

```c
  int retval = fputs((char *)p, fd) < 0 ? FAIL : OK;
  free(p);
  return retval;
```