*/
static int bytes_remaining(int fd, size_t *file_size)
{
- int rc = 0;
size_t bytes_read = 0;
- long page_size = sysconf(_SC_PAGESIZE);
+ long page_size;
char *temp_buf;
+ int rc = 0;
+
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size < 0)
+ return -EINVAL;
temp_buf = malloc(page_size);
if (temp_buf == NULL)
static
int copy_file_expandable(const char *path, char **buf, size_t *file_size)
{
- long page_size = sysconf(_SC_PAGESIZE);
- int rc = 0;
+ long page_size;
char *temp_buf;
- int fd;
+ int rc = 0, fd;
FILE *fp;
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size < 0) {
+ rc = -errno;
+ goto out;
+ }
+
fp = open_memstream(buf, file_size);
if (fp == NULL) {
rc = -errno;
return rc;
}
-int lcfg_param_get_yaml(yaml_parser_t *reply, struct nl_sock *sk,
- int version, char *pattern)
+static int lcfg_param_get_yaml(yaml_parser_t *reply, struct nl_sock *sk,
+ int version, char *pattern)
{
char source[PATH_MAX / 2], group[GENL_NAMSIZ + 1];
char *family = "lustre", *tmp;