-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Description
in rdbSave(char *filename, rdbSaveInfo *rsi),
If first fclose() return EOF, function goto werr, excute fclose() again.
But the Linux Programmer's Manual indicate that any further access (including another call to fclose()) to the stream results in undefined behavior.
It is possible that A segfault or any error occurred.
Linux Programmer's Manual
FCLOSE(3) Linux Programmer's Manual FCLOSE(3)
NAME
fclose - close a stream
SYNOPSIS
#include <stdio.h>
int fclose(FILE *stream);
DESCRIPTION
The fclose() function flushes the stream pointed to by stream (writing
any buffered output data using fflush(3)) and closes the underlying
file descriptor.
The behaviour of fclose() is undefined if the stream parameter is an
illegal pointer, or is a descriptor already passed to a previous invo‐
cation of fclose().
RETURN VALUE
Upon successful completion 0 is returned. Otherwise, EOF is returned
and errno is set to indicate the error. In either case any further
access (including another call to fclose()) to the stream results in
undefined behavior.