MCPcopy Create free account
hub / github.com/coreutils/coreutils / synchronize_output

Function synchronize_output

src/dd.c:2378–2402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2376 Return zero if successful, an exit status otherwise. */
2377
2378static int
2379synchronize_output (void)
2380{
2381 int exit_status = 0;
2382 int mask = conversions_mask;
2383 conversions_mask &= ~ (C_FDATASYNC | C_FSYNC);
2384
2385 if ((mask & C_FDATASYNC) && ifdatasync (STDOUT_FILENO) != 0)
2386 {
2387 if (errno != ENOSYS && errno != EINVAL)
2388 {
2389 diagnose (errno, _("fdatasync failed for %s"), quoteaf (output_file));
2390 exit_status = EXIT_FAILURE;
2391 }
2392 mask |= C_FSYNC;
2393 }
2394
2395 if ((mask & C_FSYNC) && ifsync (STDOUT_FILENO) != 0)
2396 {
2397 diagnose (errno, _("fsync failed for %s"), quoteaf (output_file));
2398 return EXIT_FAILURE;
2399 }
2400
2401 return exit_status;
2402}
2403
2404int
2405main (int argc, char **argv)

Callers 2

cleanupFunction · 0.85
mainFunction · 0.85

Calls 3

ifdatasyncFunction · 0.85
diagnoseFunction · 0.85
ifsyncFunction · 0.85

Tested by

no test coverage detected