mirror of
https://sourceware.org/git/glibc.git
synced 2024-09-19 16:10:01 +00:00
tests: replace ftruncate by xftruncate
With fortification enabled, ftruncate calls return result needs to be checked, has it gets the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
parent
026a84a54d
commit
32043daaaf
@ -166,7 +166,7 @@ short_copy (void)
|
|||||||
inoff = 3;
|
inoff = 3;
|
||||||
xlseek (infd, shift, SEEK_SET);
|
xlseek (infd, shift, SEEK_SET);
|
||||||
}
|
}
|
||||||
ftruncate (outfd, 0);
|
xftruncate (outfd, 0);
|
||||||
xlseek (outfd, 0, SEEK_SET);
|
xlseek (outfd, 0, SEEK_SET);
|
||||||
outoff = 0;
|
outoff = 0;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <support/support.h>
|
#include <support/support.h>
|
||||||
#include <support/temp_file.h>
|
#include <support/temp_file.h>
|
||||||
#include <support/xthread.h>
|
#include <support/xthread.h>
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
check_stderr (bool expect_errmsg, FILE *stderr_trapped)
|
check_stderr (bool expect_errmsg, FILE *stderr_trapped)
|
||||||
@ -48,7 +49,7 @@ check_stderr (bool expect_errmsg, FILE *stderr_trapped)
|
|||||||
fputs (lineptr, stdout);
|
fputs (lineptr, stdout);
|
||||||
}
|
}
|
||||||
rewind (stderr_trapped);
|
rewind (stderr_trapped);
|
||||||
ftruncate (fileno (stderr_trapped), 0);
|
xftruncate (fileno (stderr_trapped), 0);
|
||||||
return got_errmsg == expect_errmsg;
|
return got_errmsg == expect_errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
#define MB_EXP \
|
#define MB_EXP \
|
||||||
"null mode test 1: Invalid or incomplete multibyte or wide character\n" \
|
"null mode test 1: Invalid or incomplete multibyte or wide character\n" \
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("multibyte test succeeded");
|
puts ("multibyte test succeeded");
|
||||||
|
|
||||||
lseek (fd, 0, SEEK_SET);
|
lseek (fd, 0, SEEK_SET);
|
||||||
ftruncate (fd, 0);
|
xftruncate (fd, 0);
|
||||||
|
|
||||||
if (dup2 (fd, 2) == -1)
|
if (dup2 (fd, 2) == -1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user