Skip to content

Commit 961c2b9

Browse files
committed
Updated arch_ops and added missing error msgs
1 parent 45662c0 commit 961c2b9

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/libltfs/arch/ltfs_arch_ops.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ extern "C" {
126126

127127
#define arch_strcpy(dest, size, src) strcpy_s((dest), (size), (src))
128128

129-
#define arch_strncpy(dest, src, size, count) strncpy_s((dest), (size), (src), (count))
129+
#define arch_strncpy(dest, src, size, cnt) strncpy_s((dest), (size), (src), (cnt))
130130

131131
#define arch_strcat(dest, size, src) strcat_s((dest), (size), (src))
132132

@@ -175,7 +175,7 @@ extern "C" {
175175

176176
#define arch_strcpy(dest, unused, src) ({if(unused || !unused) {strcpy(dest, src);}})
177177

178-
#define arch_strncpy(dest, src, unused, count) strncpy(dest, src, count)
178+
#define arch_strncpy(dest, src, unused, cnt) strncpy(dest, src, cnt)
179179

180180
#define arch_strcat(dest, unused, src)( {if(unused || !unused){ strcat(dest, src);}})
181181

src/libltfs/index_criteria.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@ int index_criteria_parse_size(const char *criteria, size_t len, struct index_cri
202202
int ret = 0, multiplier = 1;
203203
size_t sizelen = 0;
204204
char *rule = NULL, last, *ptr;
205-
int ruleLen = (sizeof(char) * (int)(len + 1));
206-
rule = (char*)calloc(ruleLen,sizeof(char));
205+
int lenrule = (sizeof(char) * (int)(len + 1));
206+
rule = (char*)calloc(lenrule,sizeof(char));
207207
if (rule == NULL) {
208+
ltfsmsg(LTFS_ERR, 10001E, __FUNCTION__);
208209
return -LTFS_NO_MEMORY;
209210
}
210211
sizelen = strlen("size=");
@@ -266,6 +267,7 @@ int index_criteria_parse_name(const char *criteria, size_t len, struct index_cri
266267
rulebuf = (char*)malloc(sizeof(char) * (len + 1));
267268
if (rulebuf == NULL)
268269
{
270+
ltfsmsg(LTFS_ERR, 10001E, __FUNCTION__);
269271
return -LTFS_NO_MEMORY;
270272
}
271273
struct ltfs_name *rule_ptr;

src/libltfs/ltfs_fsops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,12 +2023,14 @@ int ltfs_fsops_target_absolute_path(const char *link, const char *target, char *
20232023
int work_buf_len = len + len2 + 1;
20242024
work_buf = malloc(work_buf_len);
20252025
if (!work_buf) {
2026+
ltfsmsg(LTFS_ERR, 10001E, "ltfs_fsops_target_absolute_path: work_buf");
20262027
return -LTFS_NO_MEMORY;
20272028
}
20282029
int target_buf_len = len2 + 1;
20292030
target_buf = malloc(target_buf_len);
20302031
if (!target_buf) {
20312032
free(work_buf);
2033+
ltfsmsg(LTFS_ERR, 10001E, "ltfs_fsops_target_absolute_path: target_buf");
20322034
return -LTFS_NO_MEMORY;
20332035
}
20342036

0 commit comments

Comments
 (0)