If a profile file is a special device such as a pipe, then reloading
it will cause us to discard its contents. Repurpose the first
PROFILE_FILE flag bit to indicate that the file should not be
reloaded. In profile_update_file_data_locked(), set the flag on the
first load if stat() doesn't indicate a regular file, and check the
flag before testing whether we need to perform any subsequent reload.
Later on in profile_update_file_data_locked(), specifically unset the
DIRTY flag rather than unsetting all flags other than SHARED, so that
we don't clear the NO_RELOAD flag.
ticket: 8651
FILE *f;
int isdir = 0;
+ if ((data->flags & PROFILE_FILE_NO_RELOAD) && data->root != NULL)
+ return 0;
+
#ifdef HAVE_STAT
now = time(0);
if (now == data->last_stat && data->root != NULL) {
profile_free_node(data->root);
data->root = 0;
}
+
+ /* Only try to reload regular files, not devices such as pipes. */
+ if ((st.st_mode & S_IFMT) != S_IFREG)
+ data->flags |= PROFILE_FILE_NO_RELOAD;
#else
/*
* If we don't have the stat() call, assume that our in-core
}
data->upd_serial++;
- data->flags &= PROFILE_FILE_SHARED; /* FIXME same as '=' operator */
+ data->flags &= ~PROFILE_FILE_DIRTY;
if (isdir) {
retval = profile_process_directory(data->filespec, &data->root);
/*
* 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_DEPRECATED_RW 0x0001
+#define PROFILE_FILE_NO_RELOAD 0x0001
#define PROFILE_FILE_DIRTY 0x0002
#define PROFILE_FILE_SHARED 0x0004