Commit 395cb389 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

fix return code of kernel_set_nr_hugepages()

parent 275c193f
......@@ -251,16 +251,19 @@ int kernel_get_nr_hugepages()
int kernel_set_nr_hugepages(int nr)
FILE *f;
int ret;
f = fopen(PROCFS_PATH "/sys/vm/nr_hugepages", "w");
if (!f) {
if (access("/.dockerenv", F_OK) != -1) {
ret = access("/.dockerenv", F_OK);
if (ret != -1) {
warning("This functionality is unavailable in this mode. Please run the Docker container in the privileged mode:");
warning(" $ docker run --privilged ...");
serror("Failed to open %s", PROCFS_PATH "/sys/vm/nr_hugepages");
warning("Failed to open %s", PROCFS_PATH "/sys/vm/nr_hugepages");
return -1;
fprintf(f, "%d\n", nr);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment