|
Packit Service |
1d77c2 |
/* Test that _IO_wfile_sync does not crash (bug 20568).
|
|
Packit Service |
1d77c2 |
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
Packit Service |
1d77c2 |
This file is part of the GNU C Library.
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
1d77c2 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d77c2 |
License as published by the Free Software Foundation; either
|
|
Packit Service |
1d77c2 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d77c2 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d77c2 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d77c2 |
Lesser General Public License for more details.
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d77c2 |
License along with the GNU C Library; if not, see
|
|
Packit Service |
1d77c2 |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
#include <locale.h>
|
|
Packit Service |
1d77c2 |
#include <stdio.h>
|
|
Packit Service |
1d77c2 |
#include <wchar.h>
|
|
Packit Service |
1d77c2 |
#include <support/check.h>
|
|
Packit Service |
1d77c2 |
#include <support/xunistd.h>
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
static int
|
|
Packit Service |
1d77c2 |
do_test (void)
|
|
Packit Service |
1d77c2 |
{
|
|
Packit Service |
1d77c2 |
TEST_VERIFY_EXIT (setlocale (LC_ALL, "de_DE.UTF-8") != NULL);
|
|
Packit Service |
1d77c2 |
/* Fill the stdio buffer and advance the read pointer. */
|
|
Packit Service |
1d77c2 |
TEST_VERIFY_EXIT (fgetwc (stdin) != WEOF);
|
|
Packit Service |
1d77c2 |
/* This calls _IO_wfile_sync, it should not crash. */
|
|
Packit Service |
1d77c2 |
TEST_VERIFY_EXIT (setvbuf (stdin, NULL, _IONBF, 0) == 0);
|
|
Packit Service |
1d77c2 |
/* Verify that the external file offset has been synchronized. */
|
|
Packit Service |
1d77c2 |
TEST_COMPARE (xlseek (0, 0, SEEK_CUR), 1);
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
return 0;
|
|
Packit Service |
1d77c2 |
}
|
|
Packit Service |
1d77c2 |
|
|
Packit Service |
1d77c2 |
#include <support/test-driver.c>
|