int fflush(FAR FILE *stream) { int ret; /* Is the stream argument NULL? */ if (!stream) { /* Yes... then this is a request to flush all streams */ ret = lib_flushall(sched_getstreams()); } else { ret = lib_fflush(stream, true); } /* Check the return value */ if (ret < 0) { /* An error occurred during the flush AND/OR we were unable to flush * all of the buffered write data. Set the errno value. */ set_errno(-ret); /* And return EOF on failure. */ return EOF; } return OK; }
int fflush(FAR FILE *stream) { /* Is the stream argument NULL? */ if (!stream) { /* Yes... then this is a request to flush all streams */ return lib_flushall(sched_getstreams()); } else if (lib_fflush(stream, true) != 0) { /* An error occurred during the flush AND/OR we were unable to flush all * of the buffered write data. Return EOF on failure. */ return EOF; } return OK; }