mailing list of musl libc
 help / color / mirror / code / Atom feed
22debf00bf15097a36deb4dad7b5335e1fc90bb7 blob 872 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
#include "stdio_impl.h"

static int __fflush_unlocked(FILE *f)
{
	/* If writing, flush output */
	if (f->wpos > f->wbase) {
		f->write(f, 0, 0);
		if (!f->wpos) return EOF;
	}

	/* If reading, sync position, per POSIX */
	if (f->rpos < f->rend) f->seek(f, f->rpos-f->rend, SEEK_CUR);

	/* Clear read and write modes */
	f->wpos = f->wbase = f->wend = 0;
	f->rpos = f->rend = 0;

	return 0;
}

/* stdout.c will override this if linked */
WEAK_PROVIDE_DUMMY;
_Readonly_alias FILE *const __stdout_used;

int fflush(FILE *f)
{
	int r;

	if (f) {
		FLOCK(f);
		r = __fflush_unlocked(f);
		FUNLOCK(f);
		return r;
	}

	r = __stdout_used ? fflush(__stdout_used) : 0;

	OFLLOCK();
	for (f=libc.ofl_head; f; f=f->next) {
		FLOCK(f);
		if (f->wpos > f->wbase) r |= __fflush_unlocked(f);
		FUNLOCK(f);
	}
	OFLUNLOCK();
	
	return r;
}

weak_alias(__fflush_unlocked, fflush_unlocked);
debug log:

solving 22debf0 ...
found 22debf0 in https://inbox.vuxu.org/musl/cec5070e43b6a06a77908c926d8822ed58baa458.1360968989.git.Jens.Gustedt@inria.fr/
found af70950 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 af7095033bca73c25a5488ebc2769207e5483666	src/stdio/fflush.c

applying [1/1] https://inbox.vuxu.org/musl/cec5070e43b6a06a77908c926d8822ed58baa458.1360968989.git.Jens.Gustedt@inria.fr/
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index af70950..22debf0 100644

Checking patch src/stdio/fflush.c...
Applied patch src/stdio/fflush.c cleanly.

index at:
100644 22debf00bf15097a36deb4dad7b5335e1fc90bb7	src/stdio/fflush.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).