#endif
}
+int profile_file_is_writable(prf_file_t profile)
+{
+ if (profile && profile->data) {
+ return rw_access(profile->data->filespec);
+ } else {
+ return 0;
+ }
+}
+
prf_data_t
profile_make_prf_data(const char *filename)
{
}
set_cloexec_file(f);
data->upd_serial++;
- data->flags &= PROFILE_FILE_SHARED;
- if (rw_access(data->filespec))
- data->flags |= PROFILE_FILE_RW;
+ data->flags &= PROFILE_FILE_SHARED; /* FIXME same as '=' operator */
retval = profile_parse_file(f, &data->root);
fclose(f);
if (retval) {
}
data->flags = 0;
- if (rw_access(outfile))
- data->flags |= PROFILE_FILE_RW;
retval = 0;
errout:
/*
* The profile flags
+ *
+ * Deprecated use of read/write profile flag.
+ * Check whether file is writable lazily so we don't call access as often.
*/
-#define PROFILE_FILE_RW 0x0001
-#define PROFILE_FILE_DIRTY 0x0002
-#define PROFILE_FILE_SHARED 0x0004
+#define PROFILE_FILE_DEPRECATED_RW 0x0001
+#define PROFILE_FILE_DIRTY 0x0002
+#define PROFILE_FILE_SHARED 0x0004
/*
* This structure defines the high-level, user visible profile_t
errcode_t profile_close_file
(prf_file_t profile);
+int profile_file_is_writable
+ (prf_file_t profile);
+
void profile_dereference_data (prf_data_t);
void profile_dereference_data_locked (prf_data_t);