zyimage.c:10: error: "_POSIX_SOURCE" redefined [-Werror]
zyimage.c:11: error: "_POSIX_C_SOURCE" redefined [-Werror]
zyimage.c:132:5: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
*
*/
+#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
+#endif
+
+#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L /* getopt */
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
f = fopen(argv[optind], "r+");
if (f != NULL)
{
+ size_t r;
+
fseek(f, sizeof(sign)*-1, SEEK_END);
- fread(&oldsign, sizeof(oldsign), 1, f);
+ r = fread(&oldsign, sizeof(oldsign), 1, f);
+ if (r != 1)
+ {
+ printf("Failed to read oldsign\n");
+ exit(0);
+ }
if (strncmp(oldsign.magic,"ZNBG", sizeof(oldsign.magic)) == 0 )
{