From 3f4cf31e8779a597cd919159ab0ec33ad3862096 Mon Sep 17 00:00:00 2001 From: openeuler-iSula Date: Thu, 26 Dec 2019 17:28:12 +0800 Subject: [PATCH] lxcfs: fix new patch format Signed-off-by: openeuler-iSula --- 0021-remove-securec-functions.patch | 173 ++++++++++++++-------------- 1 file changed, 87 insertions(+), 86 deletions(-) diff --git a/0021-remove-securec-functions.patch b/0021-remove-securec-functions.patch index 771d939..9c022d6 100644 --- a/0021-remove-securec-functions.patch +++ b/0021-remove-securec-functions.patch @@ -1,86 +1,87 @@ -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: \ No newline at end of file +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: + -- Gitee