Lines Matching refs:conf
54 int tst_sys_conf_save(const struct tst_path_val *conf)
61 if (!conf || !conf->path)
64 if (access(conf->path, F_OK) != 0) {
65 if (conf->flags & TST_SR_SKIP_MISSING) {
67 conf->path);
71 ttype = (conf->flags & TST_SR_TBROK_MISSING) ? TBROK : TCONF;
72 tst_brk(ttype | TERRNO, "Path not found: %s", conf->path);
75 if (access(conf->path, W_OK) != 0) {
76 if (conf->flags & TST_SR_SKIP_RO) {
78 conf->path);
82 ttype = (conf->flags & TST_SR_TBROK_RO) ? TBROK : TCONF;
83 tst_brk(ttype | TERRNO, "Path is not writable: %s", conf->path);
86 fp = fopen(conf->path, "r");
89 print_error(__LINE__, conf->flags & TST_SR_IGNORE_ERR,
90 "Failed to open '%s' for reading", conf->path);
98 if (conf->flags & TST_SR_IGNORE_ERR)
102 conf->path);
105 tst_sys_conf_save_str(conf->path, line);
107 if (!conf->val)
110 fp = fopen(conf->path, "w");
113 print_error(__LINE__, conf->flags & TST_SR_IGNORE_ERR,
114 "Failed to open '%s' for writing", conf->path);
118 iret = fputs(conf->val, fp);
121 print_error(__LINE__, conf->flags & TST_SR_IGNORE_ERR,
122 "Failed to write into '%s'", conf->path);
128 print_error(__LINE__, conf->flags & TST_SR_IGNORE_ERR,
129 "Failed to close '%s'", conf->path);
141 tst_res(TINFO, "Restoring conf.: %s -> %s\n",