Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/tests/kernel



In article <20130219224428.5DD571758D%cvs.netbsd.org@localhost>,
Paul Goyette <source-changes-d%NetBSD.org@localhost> wrote:
>-=-=-=-=-=-
>
>+      const char *pipe_errmsg = "child: pipe write failed\n";
> 
>       (void)unlink(lockfile);
> 
>@@ -145,8 +146,8 @@ ATF_TC_BODY(randlock, tc)
>               switch (pid[i]) {
>               case 0:
>                       if (write(pipe_fd[1], &pipe_out, 1) != 1)
>-                              printf("write_pipe(%i): %s", i,
>-                              strerror(errno));
>+                              write(STDERR_FILENO, pipe_errmsg,
>+                                  __arraycount(pipe_errmsg));

foo is a pointer so this will print the first sizeof(char *) characters.
Even if you correct it to be char foo[] you need arraycount() - 1 so you
don't print the NUL.

christos



Home | Main Index | Thread Index | Old Index