MCPcopy Create free account
hub / github.com/apache/cloudberry / tar_write

Function tar_write

src/bin/pg_basebackup/walmethods.c:559–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557#endif
558
559static ssize_t
560tar_write(Walfile f, const void *buf, size_t count)
561{
562 ssize_t r;
563
564 Assert(f != NULL);
565 tar_clear_error();
566
567 /* Tarfile will always be positioned at the end */
568 if (!tar_data->compression)
569 {
570 errno = 0;
571 r = write(tar_data->fd, buf, count);
572 if (r != count)
573 {
574 /* If write didn't set errno, assume problem is no disk space */
575 tar_data->lasterrno = errno ? errno : ENOSPC;
576 return -1;
577 }
578 ((TarMethodFile *) f)->currpos += r;
579 return r;
580 }
581#ifdef HAVE_LIBZ
582 else
583 {
584 if (!tar_write_compressed_data(unconstify(void *, buf), count, false))
585 return -1;
586 ((TarMethodFile *) f)->currpos += count;
587 return count;
588 }
589#else
590 else
591 {
592 /* Can't happen - compression enabled with no libz */
593 tar_data->lasterrno = ENOSYS;
594 return -1;
595 }
596#endif
597}
598
599static bool
600tar_write_padding_data(TarMethodFile *f, size_t bytes)

Callers 2

tar_write_padding_dataFunction · 0.85
tar_closeFunction · 0.85

Calls 1

Tested by

no test coverage detected