Skip to content
Snippets Groups Projects
Commit 7b886aae authored by Simon McVittie's avatar Simon McVittie
Browse files

pv-mtree: Don't log repeated warnings if unable to set lots of mtimes


If the filesystem or file ownership doesn't support setting the mtime,
all of them will fail in the same way, leading to a lot of log-spam.
In particular, this is likely to happen on NTFS or when operating on a
directory owned by a different user.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 48818377
No related branches found
No related tags found
1 merge request!582pv-runtime: Tolerate inability to chmod files if the permissions look OK
......@@ -441,6 +441,7 @@ pv_mtree_apply (const char *mtree,
g_autoptr(SrtProfilingTimer) timer = NULL;
glnx_autofd int source_files_fd = -1;
guint line_number = 0;
GLogLevelFlags set_mtime_warning_level = G_LOG_LEVEL_WARNING;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (mtree != NULL, FALSE);
......@@ -689,8 +690,12 @@ pv_mtree_apply (const char *mtree,
};
if (futimens (fd, times) != 0)
g_warning ("Unable to set mtime of \"%s\" in \"%s\": %s",
entry.name, sysroot, g_strerror (errno));
{
g_log (G_LOG_DOMAIN, set_mtime_warning_level,
"Unable to set mtime of \"%s\" in \"%s\": %s",
entry.name, sysroot, g_strerror (errno));
set_mtime_warning_level = G_LOG_LEVEL_INFO;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment