lxcfs/0021-remove-securec-functions.patch
2019-12-26 15:32:24 +08:00

86 lines
2.5 KiB
Diff

diff --git a/Makefile.am b/Makefile.am
index ca73156..ac6066d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,7 @@ lxcfs_LTLIBRARIES = liblxcfs.la
EXTRA_LTLIBRARIES = liblxcfstest.la
lxcfs_SOURCES = lxcfs.c
-lxcfs_LDADD = -ldl -lsecurec
+lxcfs_LDADD = -ldl
lxcfs_CFLAGS = $(AM_CFLAGS)
lxcfs_LDFLAGS = $(AM_LDFLAGS)
bin_PROGRAMS = lxcfs
diff --git a/bindings.c b/bindings.c
index 446a1d0..9939661 100644
--- a/bindings.c
+++ b/bindings.c
@@ -39,7 +39,6 @@
#include "bindings.h"
#include "config.h" // for VERSION
-#include "securec.h"
/* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */
#define LXCFS_NUMSTRLEN64 21
@@ -4457,7 +4456,6 @@ err:
static int proc_partitions_read(char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
- int ret = 0;
char dev_name[72] = {0};
struct fuse_context *fc = fuse_get_context();
struct file_info *d = (struct file_info *)fi->fh;
@@ -4481,13 +4479,7 @@ static int proc_partitions_read(char *buf, size_t size, off_t offset,
return 0;
int left = d->size - offset;
total_len = left > size ? size: left;
- ret = memcpy_s(buf, size, cache + offset, total_len);
- if (ret != 0) {
- lxcfs_error("%s\n", "Internal error: memcpy buf failed");
- rv = 0;
- goto err;
- }
-
+ memcpy(buf, cache + offset, total_len);
return total_len;
}
@@ -4512,21 +4504,10 @@ static int proc_partitions_read(char *buf, size_t size, off_t offset,
char lbuf[256];
if (lines < 2) {
- ret = strncpy_s(lbuf, sizeof(lbuf), line, sizeof(lbuf)-1);
- if (ret != 0) {
- lxcfs_error("%s\n", "Internal error: strncpy line failed");
- rv = 0;
- goto err;
- }
-
+ strncpy(lbuf, line, sizeof(lbuf)-1);
lines++;
} else {
- ret = memset_s(dev_name, sizeof(dev_name), 0, sizeof(dev_name));
- if (ret != 0) {
- lxcfs_error("%s\n", "Internal error: memset devname failed");
- rv = 0;
- goto err;
- }
+ memset(dev_name, 0, sizeof(dev_name));
i = sscanf(line, "%u %u %llu %71s", &major, &minor, &blocks, dev_name);
if (i != 4)
@@ -4562,12 +4543,7 @@ static int proc_partitions_read(char *buf, size_t size, off_t offset,
if (total_len > size )
total_len = size;
- ret = memcpy_s(buf, size, d->buf, total_len);
- if (ret != 0) {
- lxcfs_error("%s\n", "Internal error: memcpy buf failed");
- rv = 0;
- goto err;
- }
+ memcpy(buf, d->buf, total_len);
rv = total_len;
err: