#include "libc_private.h"
#include "local.h"
+// 3340719: __puts_null__ is used if string is NULL. Shared by fputs.c
+__private_extern__ char const __puts_null__[] = "(null)";
+
/*
* Write the given string to stdout, appending a newline.
*/
char const *s;
{
int retval;
- size_t c = strlen(s);
+ size_t c;
struct __suio uio;
struct __siov iov[2];
+ // 3340719: __puts_null__ is used if s is NULL
+ if(s == NULL)
+ s = __puts_null__;
iov[0].iov_base = (void *)s;
- iov[0].iov_len = c;
+ iov[0].iov_len = c = strlen(s);
iov[1].iov_base = "\n";
iov[1].iov_len = 1;
uio.uio_resid = c + 1;