string test alignment fix by Mahesh Bodapati
[libc-test.git] / src / regression / mkdtemp-failure.c
blobfa54c133a88abaa4458f8ff2d988821312709d6a
1 // commit: 69ecbd0f3188be97f91cc0d6415836d23e88f7fc 2011-02-19
2 // commit: 382584724308442f03f3d29f7fc6de9e9d140982 2011-06-12
3 // commit: c4685ae429a0cce4b285859d62a71fe603f0a864 2013-08-02
4 // mkdtemp should return -1 on bad template
5 #define _DEFAULT_SOURCE 1
6 #define _BSD_SOURCE 1
7 #include <stdlib.h>
8 #include <string.h>
9 #include <errno.h>
10 #include "test.h"
12 char *mkdtemp(char *);
14 #define S "/dev/null/fooXXXX"
16 int main(void)
18 char p[] = S;
19 char *r;
21 r = mkdtemp(p);
22 if (r)
23 t_error("mkdtemp(" S ") did not fail\n");
24 if (memcmp(p, S, sizeof p) != 0)
25 t_error("mkdtemp(" S ") modified the template: %s\n", p);
26 if (r == 0 && errno != EINVAL)
27 t_error("mkdtemp(" S ") failed with %d [%s] instead of %d [%s]\n",
28 errno, strerror(errno), EINVAL, strerror(EINVAL));
29 return t_status;