* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#include <arpa/inet.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <arpa/inet.h>
#include "conf.h"
+#include "config.h"
#include "confile.h"
#include "confile_utils.h"
#include "error.h"
retlen = strlcpy(valuep, value, size);
if (retlen >= size)
- ERROR("Network devie name \"%s\" is too long (>= %zu)", value,
+ ERROR("Network device name \"%s\" is too long (>= %zu)", value,
size);
return 0;
return value_len;
}
+int lxc_get_conf_bool(struct lxc_conf *c, char *retv, int inlen, bool v)
+{
+ int len;
+ int fulllen = 0;
+
+ if (!retv)
+ inlen = 0;
+ else
+ memset(retv, 0, inlen);
+
+ strprint(retv, inlen, "%d", v);
+
+ return fulllen;
+}
+
int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
{
int len;
{
char *endptr = NULL;
- if (strncmp(*value, "unlimited", sizeof("unlimited") - 1) == 0) {
+ if (strncmp(*value, "unlimited", STRLITERALLEN("unlimited")) == 0) {
*res = RLIM_INFINITY;
- *value += sizeof("unlimited") - 1;
+ *value += STRLITERALLEN("unlimited");
return true;
}