Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* NOTE: this tests functionality beyond POSIX. POSIX does not allow
exit to be called more than once. */
static void *
tf_accept (void *arg)
{
+ int tfd;
struct sockaddr_un sun;
/* To test a non-blocking accept call we make the call file by using
a datagrame socket. */
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-1-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_send (void *arg)
{
+ int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_recv (void *arg)
{
+ int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-3-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_recvfrom (void *arg)
{
+ int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-4-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_recvmsg (void *arg)
{
+ int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_sendto (void *arg)
{
+ int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which sendto()
// blocks we can enable this test to run in both rounds.
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-6-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_sendmsg (void *arg)
{
+ int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which sendmsg()
// blocks we can enable this test to run in both rounds.
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
static void *
tf_connect (void *arg)
{
+ int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which connect()
// blocks we can enable this test to run in both rounds.
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
- if (mktemp (sun.sun_path) == NULL)
+ tfd = mkstemp(sun.sun_path);
+ if (tfd < 0)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
-
+ close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,