diff options
author | Thomas Haller <thaller@redhat.com> | 2016-02-13 15:23:21 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-02-21 18:31:39 +0100 |
commit | 6ee744f41d0c3484c2626a37fd3cd5a7b58af3ca (patch) | |
tree | 58e5b0642850f3d46e4f662b99d44a5ddfccd263 /callouts | |
parent | 4eb5ba8b026b1aed9c007ed5df30b368869cc59a (diff) | |
download | NetworkManager-6ee744f41d0c3484c2626a37fd3cd5a7b58af3ca.tar.gz |
dispatcher: minor cleanup ignoring dispatcher scripts by filename
Diffstat (limited to 'callouts')
-rw-r--r-- | callouts/nm-dispatcher.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index 440f01a600..755d581dd4 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -495,7 +495,13 @@ check_permissions (struct stat *s, const char **out_error_msg) static gboolean check_filename (const char *file_name) { - char *bad_suffixes[] = { "~", ".rpmsave", ".rpmorig", ".rpmnew", NULL }; + static const char *bad_suffixes[] = { + "~", + ".rpmsave", + ".rpmorig", + ".rpmnew", + ".swp", + }; char *tmp; guint i; @@ -503,12 +509,12 @@ check_filename (const char *file_name) if (file_name[0] == '.') return FALSE; - for (i = 0; bad_suffixes[i]; i++) { + for (i = 0; i < G_N_ELEMENTS (bad_suffixes); i++) { if (g_str_has_suffix (file_name, bad_suffixes[i])) return FALSE; } tmp = g_strrstr (file_name, ".dpkg-"); - if (tmp && (tmp == strrchr (file_name, '.'))) + if (tmp && !strchr (&tmp[1], '.')) return FALSE; return TRUE; } |