diff --git a/zdev/src/device.c b/zdev/src/device.c index ea15abca..d17f7af4 100644 --- a/zdev/src/device.c +++ b/zdev/src/device.c @@ -1,7 +1,7 @@ /* * zdev - Modify and display the persistent configuration of devices * - * Copyright IBM Corp. 2016, 2017 + * Copyright IBM Corp. 2016, 2019 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -10,6 +10,7 @@ #include #include #include +#include #include "lib/util_path.h" @@ -521,7 +522,7 @@ void device_read_active_settings(struct device *dev, read_scope_t scope) s = setting_list_apply_actual(dev->active.settings, a, name, value); if (link || (scope == scope_all && - !util_path_is_writable(path))) + util_path_is_readonly_file("%s", path))) s->readonly = 1; if (link) free(link); diff --git a/zdev/src/module.c b/zdev/src/module.c index 09acb86e..a8e1bbb7 100644 --- a/zdev/src/module.c +++ b/zdev/src/module.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "lib/util_path.h" @@ -259,7 +260,7 @@ bool module_set_params(const char *mod, struct setting_list *settings) struct setting *s; char *path; const char *value; - bool result; + bool readonly; exit_code_t rc; /* First check if all modified settings can be applied this way. */ @@ -277,9 +278,9 @@ bool module_set_params(const char *mod, struct setting_list *settings) return false; } path = path_get_sys_module_param(mod, s->name); - result = util_path_is_writable(path); + readonly = util_path_is_readonly_file("%s", path); free(path); - if (!result) { + if (readonly) { /* Sysfs file is not writable. */ return false; }