diff --git a/meson.build b/meson.build index 082463bc..f9bbded6 100644 --- a/meson.build +++ b/meson.build @@ -114,6 +114,11 @@ if get_option('buildtype').contains('debug') ]) endif +compiler_c_flags += cc.get_supported_arguments([ + '-Wno-format-y2k', + '-Wno-declaration-after-statement', +]) + glib_req_version = '>= 2.30.0' gio_dep = dependency('gio-2.0', version: glib_req_version) diff --git a/src/polkit/polkitenumtypes.c.template b/src/polkit/polkitenumtypes.c.template index 7704ccad..24585d4c 100644 --- a/src/polkit/polkitenumtypes.c.template +++ b/src/polkit/polkitenumtypes.c.template @@ -13,7 +13,7 @@ GType { static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) + if (g_once_init_enter ((gsize*) &g_define_type_id__volatile)) { static const G@Type@Value values[] = { /*** END value-header ***/ diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c index f7a05685..f808e3d5 100644 --- a/src/polkit/polkitidentity.c +++ b/src/polkit/polkitidentity.c @@ -47,7 +47,7 @@ polkit_identity_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) + if (g_once_init_enter ((gsize*) &g_define_type_id__volatile)) { static const GTypeInfo info = { diff --git a/src/polkit/polkitimplicitauthorization.h b/src/polkit/polkitimplicitauthorization.h index 64b16849..67a8b8cb 100644 --- a/src/polkit/polkitimplicitauthorization.h +++ b/src/polkit/polkitimplicitauthorization.h @@ -58,7 +58,7 @@ const gchar *polkit_implicit_authorization_to_string (PolkitIm /** * polkit_implicit_authorization_from_string: * @string: A string - * @out_implicit_authorization: (out caller-allocates optional): The location of the resulting deserialization + * @out_implicit_authorization: (out caller-allocates): The location of the resulting deserialization */ gboolean polkit_implicit_authorization_from_string (const gchar *string, PolkitImplicitAuthorization *out_implicit_authorization); diff --git a/src/polkit/polkitpermission.c b/src/polkit/polkitpermission.c index f3ffbb62..3dc44748 100644 --- a/src/polkit/polkitpermission.c +++ b/src/polkit/polkitpermission.c @@ -76,7 +76,7 @@ enum static void process_result (PolkitPermission *permission, PolkitAuthorizationResult *result); -static char *get_session_state(); +static char *get_session_state(void); static void on_authority_changed (PolkitAuthority *authority, gpointer user_data); @@ -490,7 +490,7 @@ changed_check_cb (GObject *source_object, g_object_unref (permission); } -static char *get_session_state() +static char *get_session_state(void) { #ifdef HAVE_LIBSYSTEMD char *session = NULL; diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c index d4c27553..07f87d06 100644 --- a/src/polkit/polkitsubject.c +++ b/src/polkit/polkitsubject.c @@ -48,7 +48,7 @@ polkit_subject_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) + if (g_once_init_enter ((gsize*) &g_define_type_id__volatile)) { static const GTypeInfo info = { diff --git a/src/polkitagent/polkitagentenumtypes.c.template b/src/polkitagent/polkitagentenumtypes.c.template index e6cb139b..a7197bdd 100644 --- a/src/polkitagent/polkitagentenumtypes.c.template +++ b/src/polkitagent/polkitagentenumtypes.c.template @@ -13,7 +13,7 @@ GType { static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) + if (g_once_init_enter ((gsize*) &g_define_type_id__volatile)) { static const G@Type@Value values[] = { /*** END value-header ***/ diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c index 7358b178..47c4006a 100644 --- a/src/polkitagent/polkitagenthelperprivate.c +++ b/src/polkitagent/polkitagenthelperprivate.c @@ -129,7 +129,7 @@ send_dbus_message (const char *cookie, const char *user) } void -flush_and_wait () +flush_and_wait (void) { fflush (stdout); fflush (stderr); diff --git a/src/polkitagent/polkitagenthelperprivate.h b/src/polkitagent/polkitagenthelperprivate.h index c5145b5e..c4ba99fd 100644 --- a/src/polkitagent/polkitagenthelperprivate.h +++ b/src/polkitagent/polkitagenthelperprivate.h @@ -41,6 +41,6 @@ char *read_cookie (int argc, char **argv); gboolean send_dbus_message (const char *cookie, const char *user); -void flush_and_wait (); +void flush_and_wait (void); #endif /* __POLKIT_AGENT_HELPER_PRIVATE_H */ diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c index d4a3f46f..4749f179 100644 --- a/src/polkitagent/polkitagentsession.c +++ b/src/polkitagent/polkitagentsession.c @@ -66,7 +66,7 @@ _show_debug (void) static volatile gsize has_show_debug = 0; static gboolean show_debug_value = FALSE; - if (g_once_init_enter (&has_show_debug)) + if (g_once_init_enter ((gsize*) &has_show_debug)) { show_debug_value = (g_getenv ("POLKIT_DEBUG") != NULL); g_once_init_leave (&has_show_debug, 1); diff --git a/src/polkitbackend/polkitbackendactionlookup.c b/src/polkitbackend/polkitbackendactionlookup.c index e76f88df..b5e95cc9 100644 --- a/src/polkitbackend/polkitbackendactionlookup.c +++ b/src/polkitbackend/polkitbackendactionlookup.c @@ -75,7 +75,7 @@ polkit_backend_action_lookup_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) + if (g_once_init_enter ((gsize*) &g_define_type_id__volatile)) { static const GTypeInfo info = { diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c index 6981491f..223dc4a5 100644 --- a/src/polkitbackend/polkitbackendauthority.c +++ b/src/polkitbackend/polkitbackendauthority.c @@ -1673,7 +1673,7 @@ polkit_backend_authority_log (PolkitBackendAuthority *authority, const gchar *format, ...) { - GTimeVal now; + guint64 now; time_t now_time; struct tm *now_tm; gchar time_buf[128]; @@ -1693,13 +1693,13 @@ polkit_backend_authority_log (PolkitBackendAuthority *authority, syslog (message_log_level, "%s", message); - g_get_current_time (&now); - now_time = (time_t) now.tv_sec; + now = g_get_real_time (); + now_time = (time_t) now / G_TIME_SPAN_SECOND; now_tm = localtime (&now_time); strftime (time_buf, sizeof time_buf, "%H:%M:%S", now_tm); g_print ("%s%s%s.%03d%s: %s\n", _color_get (_COLOR_BOLD_ON), _color_get (_COLOR_FG_YELLOW), - time_buf, (gint) now.tv_usec / 1000, + time_buf, (gint) (now % G_TIME_SPAN_SECOND / G_TIME_SPAN_MILLISECOND), _color_get (_COLOR_RESET), message); diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c index 312478b1..ce63423c 100644 --- a/src/polkitbackend/polkitbackendduktapeauthority.c +++ b/src/polkitbackend/polkitbackendduktapeauthority.c @@ -763,7 +763,9 @@ runaway_killer_common(PolkitBackendJsAuthority *authority, RunawayKillerCtx *ctx { int pthread_err; gboolean cancel = FALSE; +#ifdef HAVE_PTHREAD_CONDATTR_SETCLOCK pthread_condattr_t attr; +#endif struct timespec abs_time; #ifdef HAVE_PTHREAD_CONDATTR_SETCLOCK @@ -860,9 +862,7 @@ runaway_killer_common(PolkitBackendJsAuthority *authority, RunawayKillerCtx *ctx err_clean_cond: #ifdef HAVE_PTHREAD_CONDATTR_SETCLOCK pthread_cond_destroy(&ctx->cond); -#endif err_clean_condattr: -#ifdef HAVE_PTHREAD_CONDATTR_SETCLOCK pthread_condattr_destroy(&attr); #endif return FALSE; diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c index 34d908f3..84ceec57 100644 --- a/src/polkitbackend/polkitbackendinteractiveauthority.c +++ b/src/polkitbackend/polkitbackendinteractiveauthority.c @@ -3392,7 +3392,7 @@ polkit_backend_interactive_authority_enumerate_temporary_authorizations (PolkitB GList *ret; GList *l; gint64 monotonic_now; - GTimeVal real_now; + gint64 real_now; interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (authority); priv = polkit_backend_interactive_authority_get_instance_private (interactive_authority); @@ -3431,7 +3431,7 @@ polkit_backend_interactive_authority_enumerate_temporary_authorizations (PolkitB } monotonic_now = g_get_monotonic_time (); - g_get_current_time (&real_now); + real_now = g_get_real_time () / G_TIME_SPAN_SECOND; for (l = priv->temporary_authorization_store->authorizations; l != NULL; l = l->next) { @@ -3443,8 +3443,8 @@ polkit_backend_interactive_authority_enumerate_temporary_authorizations (PolkitB if (!polkit_subject_equal (ta->scope, subject)) continue; - real_granted = (ta->time_granted - monotonic_now) / G_USEC_PER_SEC + real_now.tv_sec; - real_expires = (ta->time_expires - monotonic_now) / G_USEC_PER_SEC + real_now.tv_sec; + real_granted = (ta->time_granted - monotonic_now) / G_USEC_PER_SEC + real_now; + real_expires = (ta->time_expires - monotonic_now) / G_USEC_PER_SEC + real_now; tmp_authz = polkit_temporary_authorization_new (ta->id, ta->action_id, diff --git a/src/polkitbackend/polkitbackendsessionmonitor-systemd.c b/src/polkitbackend/polkitbackendsessionmonitor-systemd.c index 4b83edd7..91832b1a 100644 --- a/src/polkitbackend/polkitbackendsessionmonitor-systemd.c +++ b/src/polkitbackend/polkitbackendsessionmonitor-systemd.c @@ -73,6 +73,9 @@ sd_source_dispatch (GSource *source, g_warn_if_fail (callback != NULL); + if (callback == NULL) + return G_SOURCE_CONTINUE; + ret = (*callback) (user_data); sd_login_monitor_flush (sd_source->monitor); diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c index 7484f211..57889ad8 100644 --- a/src/programs/pkcheck.c +++ b/src/programs/pkcheck.c @@ -267,7 +267,7 @@ do_list_or_revoke_temp_authz (gboolean revoke) gchar *subject_cmdline; time_t obtained; time_t expires; - GTimeVal now; + gint64 now; gchar *subject_str; gchar obtained_str[64]; gchar expires_str[64]; @@ -283,15 +283,15 @@ do_list_or_revoke_temp_authz (gboolean revoke) obtained = polkit_temporary_authorization_get_time_obtained (a); expires = polkit_temporary_authorization_get_time_expires (a); - g_get_current_time (&now); + now = g_get_real_time () / G_TIME_SPAN_SECOND; broken_down = localtime (&obtained); strftime (obtained_str, sizeof (obtained_str), "%c", broken_down); broken_down = localtime (&expires); strftime (expires_str, sizeof (expires_str), "%c", broken_down); - obtained_rel_str = format_reltime (obtained - now.tv_sec); - expires_rel_str = format_reltime (expires - now.tv_sec); + obtained_rel_str = format_reltime (obtained - now); + expires_rel_str = format_reltime (expires - now); g_print ("authorization id: %s\n" "action: %s\n"