aboutsummaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-07 14:44:17 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-07 14:46:40 +0200
commit267d5318e1cbf69a071b5188dda50310af2f2f8b (patch)
tree9b17035763ab4c69458f28fe37258713c45920a5 /lib/util
parent3a7d758d1d5a9b6499bdc3f75077932ba66f89d7 (diff)
Cleanup: Move padd_file function to libtar
It's only ever used for padding tarballs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/Makemodule.am3
-rw-r--r--lib/util/padd_file.c42
2 files changed, 1 insertions, 44 deletions
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index 58333ac..1ae931b 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -2,8 +2,7 @@ libutil_la_SOURCES = lib/util/write_data.c
libutil_la_SOURCES += lib/util/read_data.c include/util.h
libutil_la_SOURCES += lib/util/mkdir_p.c include/compat.h
libutil_la_SOURCES += lib/util/str_table.c include/str_table.h
-libutil_la_SOURCES += lib/util/dirstack.c lib/util/padd_file.c
-libutil_la_SOURCES += lib/util/alloc.c
+libutil_la_SOURCES += lib/util/dirstack.c lib/util/alloc.c
libutil_la_SOURCES += lib/util/canonicalize_name.c
libutil_la_CFLAGS = $(AM_CFLAGS)
libutil_la_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/lib/util/padd_file.c b/lib/util/padd_file.c
deleted file mode 100644
index 1803139..0000000
--- a/lib/util/padd_file.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: LGPL-3.0-or-later */
-/*
- * padd_file.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "sqfs/io.h"
-#include "util.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-int padd_file(int outfd, sqfs_u64 size, size_t blocksize)
-{
- size_t padd_sz = size % blocksize;
- int status = -1;
- sqfs_u8 *buffer;
-
- if (padd_sz == 0)
- return 0;
-
- padd_sz = blocksize - padd_sz;
-
- buffer = calloc(1, padd_sz);
- if (buffer == NULL)
- goto fail_errno;
-
- if (write_data("padding output file to block size",
- outfd, buffer, padd_sz)) {
- goto out;
- }
-
- status = 0;
-out:
- free(buffer);
- return status;
-fail_errno:
- perror("padding output file to block size");
- goto out;
-}