/* expandargv test program,
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Written by Carlos O'Donell <carlos@codesourcery.com>
This file is part of the libiberty library, which is part of GCC.
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
{
char filename[256];
FILE *fd;
- size_t len;
+ size_t len, sys_fwrite;
char * parse;
/* Unique filename per test */
/* Run all possible replaces */
run_replaces (parse);
- fwrite (parse, len, sizeof (char), fd);
+ sys_fwrite = fwrite (parse, sizeof (char), len, fd);
+ if (sys_fwrite != len)
+ fatal_error (__LINE__, "Failed to write to test file.", errno);
+
free (parse);
fclose (fd);
}