Compare commits

...

13 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 6bae4b905c Revert "Add Kensington SlimBlade Trackball"
This reverts commit 8049c79b65.
2020-05-07 13:11:41 +02:00
Daan De Meyer d402edb764 resolved: Fix build error due to missing include. 2020-05-07 03:05:50 -07:00
gaurav 48a3b5c6db
netlink socket correct check (#15720) 2020-05-07 09:55:31 +02:00
Lennart Poettering f5b7d681c7 homectl: show disk free in percent in 'inspect' 2020-05-07 09:52:56 +02:00
Zbigniew Jędrzejewski-Szmek 354722dde4
Merge pull request #15733 from benjarobin/fix_warn_ndebug
Allow to build without any warning with NDEBUG defined + Bugfix
2020-05-07 09:47:19 +02:00
Benjamin Robin 08f468567d tree-wide: Workaround -Wnonnull GCC bug
See issue #6119
2020-05-07 09:43:28 +02:00
Lennart Poettering ba876a4c8d homed: open up home dir Acquire operation to unpriv clients
Apparently unpriv clients expect to be able to auth via PAM. Kinda
sucks. But it is what it is. Hence open this up.

This shouldn't be too bad in effect since clients after all need to
provide security creds for unlocking the home dir, in order to misuse
this.

Fixes: #15072
2020-05-07 09:43:02 +02:00
Daan De Meyer be28f72d6a resolved: Break include cycles 2020-05-07 09:00:48 +02:00
Benjamin Robin 0454681395 meson: Do not drop warnings (unused variable) when NDEBUG is defined
This is no longer needed, since there is now no warning with NDEBUG
defined
2020-05-06 23:03:25 +02:00
Benjamin Robin 683d0bc041 resize-fs: Use xsprintf instead of snprintf 2020-05-06 23:03:25 +02:00
Benjamin Robin 060d9c61b6 test: Use assert_se() where variables are only checked by assert
Allow to build without any warning with NDEBUG defined
2020-05-06 23:03:25 +02:00
Benjamin Robin f391597c67 tree-wide: Fix, replace assert() by assert_se() when there is side effect 2020-05-06 23:03:25 +02:00
Benjamin Robin 0a0e594a26 tree-wide: Mark as _unused_ variables that are only used in assert()
Allow to build without any warning with NDEBUG defined
2020-05-06 23:03:25 +02:00
37 changed files with 114 additions and 80 deletions

View File

@ -288,10 +288,6 @@ mouse:usb:v04b3p3107:name:*
mouse:usb:v047dp1020:*Kensington Expert Mouse* mouse:usb:v047dp1020:*Kensington Expert Mouse*
ID_INPUT_TRACKBALL=1 ID_INPUT_TRACKBALL=1
# Kensington SlimBlade Trackball
mouse:usb:v047dp2041:name:Kensington Slimblade Trackball:
ID_INPUT_TRACKBALL=1
########################################## ##########################################
# Lenovo # Lenovo
########################################## ##########################################

View File

@ -335,15 +335,6 @@ basic_disabled_warnings = [
'-Wno-unused-result', '-Wno-unused-result',
'-Wno-format-signedness', '-Wno-format-signedness',
] ]
if get_option('b_ndebug') == 'true'
# With asserts disabled with get a bunch of warnings about variables which
# are used only in the asserts. This is not useful at all, so let's just silence
# those warnings.
basic_disabled_warnings += [
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
]
endif
possible_cc_flags = [ possible_cc_flags = [
'-Werror=undef', '-Werror=undef',

View File

@ -2889,7 +2889,7 @@ int config_parse_syscall_filter(
void *userdata) { void *userdata) {
ExecContext *c = data; ExecContext *c = data;
const Unit *u = userdata; _unused_ const Unit *u = userdata;
bool invert = false; bool invert = false;
const char *p; const char *p;
int r; int r;

View File

@ -1968,7 +1968,6 @@ int manager_load_unit_prepare(
int r; int r;
assert(m); assert(m);
assert(name || path);
assert(_ret); assert(_ret);
/* This will prepare the unit for loading, but not actually /* This will prepare the unit for loading, but not actually
@ -1977,8 +1976,13 @@ int manager_load_unit_prepare(
if (path && !is_path(path)) if (path && !is_path(path))
return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path); return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path);
if (!name) if (!name) {
/* 'name' and 'path' must not both be null. Check here 'path' using assert_se() to
* workaround a bug in gcc that generates a -Wnonnull warning when calling basename(),
* but this cannot be possible in any code path (See #6119). */
assert_se(path);
name = basename(path); name = basename(path);
}
t = unit_name_to_type(name); t = unit_name_to_type(name);

View File

@ -789,7 +789,7 @@ static const sd_bus_vtable manager_vtable[] = {
"h", "h",
SD_BUS_PARAM(send_fd), SD_BUS_PARAM(send_fd),
method_acquire_home, method_acquire_home,
SD_BUS_VTABLE_SENSITIVE), SD_BUS_VTABLE_UNPRIVILEGED|SD_BUS_VTABLE_SENSITIVE),
SD_BUS_METHOD_WITH_NAMES("RefHome", SD_BUS_METHOD_WITH_NAMES("RefHome",
"sb", "sb",
SD_BUS_PARAM(user_name) SD_BUS_PARAM(user_name)

View File

@ -172,8 +172,8 @@ static int import_fs(int argc, char *argv[], void *userdata) {
progress.limit = (RateLimit) { 200*USEC_PER_MSEC, 1 }; progress.limit = (RateLimit) { 200*USEC_PER_MSEC, 1 };
/* Hook into SIGINT/SIGTERM, so that we can cancel things then */ /* Hook into SIGINT/SIGTERM, so that we can cancel things then */
assert(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0); assert_se(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0);
assert(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0); assert_se(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0);
r = btrfs_subvol_snapshot_fd_full( r = btrfs_subvol_snapshot_fd_full(
fd, fd,

View File

@ -60,7 +60,7 @@ static void mpi_export(void *buf, size_t buflen, const gcry_mpi_t x) {
static gcry_mpi_t mpi_import(const void *buf, size_t buflen) { static gcry_mpi_t mpi_import(const void *buf, size_t buflen) {
gcry_mpi_t h; gcry_mpi_t h;
unsigned len; _unused_ unsigned len;
assert_se(gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL) == 0); assert_se(gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL) == 0);
len = (gcry_mpi_get_nbits(h) + 7) / 8; len = (gcry_mpi_get_nbits(h) + 7) / 8;

View File

@ -283,7 +283,7 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *ret_mcast_gr
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
cmsg = cmsg_find(&msg, SOL_NETLINK, NETLINK_PKTINFO, CMSG_LEN(sizeof(struct nl_pktinfo))); cmsg = cmsg_find(&msg, SOL_NETLINK, NETLINK_PKTINFO, CMSG_LEN(sizeof(struct nl_pktinfo)));
if (ret_mcast_group) if (cmsg)
*ret_mcast_group = ((struct nl_pktinfo*) CMSG_DATA(cmsg))->group; *ret_mcast_group = ((struct nl_pktinfo*) CMSG_DATA(cmsg))->group;
else else
*ret_mcast_group = 0; *ret_mcast_group = 0;

View File

@ -2567,7 +2567,7 @@ static int method_can_reboot_parameter(
void *userdata, void *userdata,
sd_bus_error *error) { sd_bus_error *error) {
Manager *m = userdata; _unused_ Manager *m = userdata;
int r; int r;
assert(message); assert(message);
@ -2699,7 +2699,7 @@ static int method_can_reboot_to_firmware_setup(
void *userdata, void *userdata,
sd_bus_error *error) { sd_bus_error *error) {
Manager *m = userdata; _unused_ Manager *m = userdata;
int r; int r;
assert(message); assert(message);
@ -2888,7 +2888,7 @@ static int method_can_reboot_to_boot_loader_menu(
void *userdata, void *userdata,
sd_bus_error *error) { sd_bus_error *error) {
Manager *m = userdata; _unused_ Manager *m = userdata;
int r; int r;
assert(message); assert(message);
@ -3079,7 +3079,7 @@ static int method_can_reboot_to_boot_loader_entry(
void *userdata, void *userdata,
sd_bus_error *error) { sd_bus_error *error) {
Manager *m = userdata; _unused_ Manager *m = userdata;
int r; int r;
assert(message); assert(message);

View File

@ -112,7 +112,7 @@ static int method_get_machine(sd_bus_message *message, void *userdata, sd_bus_er
static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) { static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;
Manager *m = userdata; _unused_ Manager *m = userdata;
const char *name; const char *name;
int r; int r;
@ -471,7 +471,7 @@ static int method_get_machine_os_release(sd_bus_message *message, void *userdata
static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) { static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_hashmap_free_ Hashmap *images = NULL; _cleanup_hashmap_free_ Hashmap *images = NULL;
Manager *m = userdata; _unused_ Manager *m = userdata;
Image *image; Image *image;
Iterator i; Iterator i;
int r; int r;

View File

@ -2233,7 +2233,7 @@ void manager_dirty(Manager *manager) {
} }
static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
Manager *manager = userdata; _unused_ Manager *manager = userdata;
const sd_bus_error *e; const sd_bus_error *e;
assert(m); assert(m);
@ -2279,7 +2279,7 @@ int manager_set_hostname(Manager *m, const char *hostname) {
} }
static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
Manager *manager = userdata; _unused_ Manager *manager = userdata;
const sd_bus_error *e; const sd_bus_error *e;
assert(m); assert(m);

View File

@ -1722,7 +1722,7 @@ static int context_dump_partition_bar(Context *context, const char *node) {
bool z = false; bool z = false;
size_t c, j = 0; size_t c, j = 0;
assert((c = columns()) >= 2); assert_se((c = columns()) >= 2);
c -= 2; /* We do not use the leftmost and rightmost character cell */ c -= 2; /* We do not use the leftmost and rightmost character cell */
bar = new0(Partition*, c); bar = new0(Partition*, c);

View File

@ -9,6 +9,9 @@
#include "resolved-conf.h" #include "resolved-conf.h"
#include "resolved-dnssd.h" #include "resolved-dnssd.h"
#include "resolved-util.h" #include "resolved-util.h"
#include "resolved-manager.h"
#include "resolved-dns-search-domain.h"
#include "dns-domain.h"
#include "specifier.h" #include "specifier.h"
#include "string-table.h" #include "string-table.h"
#include "string-util.h" #include "string-util.h"

View File

@ -14,7 +14,6 @@ enum DnsStubListenerMode {
_DNS_STUB_LISTENER_MODE_INVALID = -1 _DNS_STUB_LISTENER_MODE_INVALID = -1
}; };
#include "resolved-manager.h"
#include "resolved-dns-server.h" #include "resolved-dns-server.h"
int manager_parse_config_file(Manager *m); int manager_parse_config_file(Manager *m);

View File

@ -10,8 +10,8 @@ typedef struct DnsQuery DnsQuery;
#include "resolved-dns-answer.h" #include "resolved-dns-answer.h"
#include "resolved-dns-question.h" #include "resolved-dns-question.h"
#include "resolved-dns-stream.h"
#include "resolved-dns-search-domain.h" #include "resolved-dns-search-domain.h"
#include "resolved-dns-transaction.h"
struct DnsQueryCandidate { struct DnsQueryCandidate {
DnsQuery *query; DnsQuery *query;

View File

@ -2,18 +2,19 @@
#pragma once #pragma once
#include "list.h" #include "list.h"
#include "ratelimit.h"
typedef struct DnsQueryCandidate DnsQueryCandidate;
typedef struct DnsScope DnsScope; typedef struct DnsScope DnsScope;
#include "resolved-dns-cache.h" #include "resolved-dns-cache.h"
#include "resolved-dns-dnssec.h" #include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h" #include "resolved-dns-packet.h"
#include "resolved-dns-query.h"
#include "resolved-dns-search-domain.h" #include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h" #include "resolved-dns-server.h"
#include "resolved-dns-stream.h" #include "resolved-dns-stream.h"
#include "resolved-dns-zone.h" #include "resolved-dns-zone.h"
#include "resolved-link.h"
typedef enum DnsScopeMatch { typedef enum DnsScopeMatch {
DNS_SCOPE_NO, DNS_SCOPE_NO,

View File

@ -3,6 +3,8 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "dns-domain.h" #include "dns-domain.h"
#include "resolved-dns-search-domain.h" #include "resolved-dns-search-domain.h"
#include "resolved-link.h"
#include "resolved-manager.h"
int dns_search_domain_new( int dns_search_domain_new(
Manager *m, Manager *m,

View File

@ -1,18 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once #pragma once
#include "list.h"
#include "macro.h" #include "macro.h"
typedef struct DnsSearchDomain DnsSearchDomain; typedef struct DnsSearchDomain DnsSearchDomain;
typedef struct Link Link;
typedef struct Manager Manager;
typedef enum DnsSearchDomainType { typedef enum DnsSearchDomainType {
DNS_SEARCH_DOMAIN_SYSTEM, DNS_SEARCH_DOMAIN_SYSTEM,
DNS_SEARCH_DOMAIN_LINK, DNS_SEARCH_DOMAIN_LINK,
} DnsSearchDomainType; } DnsSearchDomainType;
#include "resolved-link.h"
#include "resolved-manager.h"
struct DnsSearchDomain { struct DnsSearchDomain {
Manager *manager; Manager *manager;

View File

@ -6,6 +6,7 @@
#include "resolved-bus.h" #include "resolved-bus.h"
#include "resolved-dns-server.h" #include "resolved-dns-server.h"
#include "resolved-dns-stub.h" #include "resolved-dns-stub.h"
#include "resolved-manager.h"
#include "resolved-resolv-conf.h" #include "resolved-resolv-conf.h"
#include "siphash24.h" #include "siphash24.h"
#include "string-table.h" #include "string-table.h"

View File

@ -2,8 +2,18 @@
#pragma once #pragma once
#include "in-addr-util.h" #include "in-addr-util.h"
#include "list.h"
#include "resolve-util.h"
#include "time-util.h"
typedef struct DnsScope DnsScope;
typedef struct DnsServer DnsServer; typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsPacket DnsPacket;
typedef struct Link Link;
typedef struct Manager Manager;
#include "resolved-dnstls.h"
typedef enum DnsServerType { typedef enum DnsServerType {
DNS_SERVER_SYSTEM, DNS_SERVER_SYSTEM,
@ -35,10 +45,6 @@ typedef enum DnsServerFeatureLevel {
const char* dns_server_feature_level_to_string(int i) _const_; const char* dns_server_feature_level_to_string(int i) _const_;
int dns_server_feature_level_from_string(const char *s) _pure_; int dns_server_feature_level_from_string(const char *s) _pure_;
#include "resolved-dnstls.h"
#include "resolved-link.h"
#include "resolved-manager.h"
struct DnsServer { struct DnsServer {
Manager *manager; Manager *manager;

View File

@ -8,6 +8,7 @@
#include "io-util.h" #include "io-util.h"
#include "missing_network.h" #include "missing_network.h"
#include "resolved-dns-stream.h" #include "resolved-dns-stream.h"
#include "resolved-manager.h"
#define DNS_STREAM_TIMEOUT_USEC (10 * USEC_PER_SEC) #define DNS_STREAM_TIMEOUT_USEC (10 * USEC_PER_SEC)
#define DNS_STREAMS_MAX 128 #define DNS_STREAMS_MAX 128

View File

@ -1,9 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once #pragma once
#include "sd-event.h"
#include "ordered-set.h"
#include "socket-util.h" #include "socket-util.h"
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream; typedef struct DnsStream DnsStream;
typedef struct DnsTransaction DnsTransaction;
typedef struct Manager Manager;
#include "resolved-dns-packet.h"
#include "resolved-dnstls.h"
typedef enum DnsStreamType { typedef enum DnsStreamType {
DNS_STREAM_LOOKUP, /* Outgoing connection to a classic DNS server */ DNS_STREAM_LOOKUP, /* Outgoing connection to a classic DNS server */
@ -14,11 +23,6 @@ typedef enum DnsStreamType {
_DNS_STREAM_TYPE_INVALID = -1, _DNS_STREAM_TYPE_INVALID = -1,
} DnsStreamType; } DnsStreamType;
#include "resolved-dns-packet.h"
#include "resolved-dns-transaction.h"
#include "resolved-dnstls.h"
#include "resolved-manager.h"
#define DNS_STREAM_WRITE_TLS_DATA 1 #define DNS_STREAM_WRITE_TLS_DATA 1
/* Streams are used by three subsystems: /* Streams are used by three subsystems:

View File

@ -1,10 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once #pragma once
#include "sd-event.h"
typedef struct DnsTransaction DnsTransaction; typedef struct DnsTransaction DnsTransaction;
typedef enum DnsTransactionState DnsTransactionState; typedef enum DnsTransactionState DnsTransactionState;
typedef enum DnsTransactionSource DnsTransactionSource; typedef enum DnsTransactionSource DnsTransactionSource;
#include "resolved-dns-answer.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-server.h"
enum DnsTransactionState { enum DnsTransactionState {
DNS_TRANSACTION_NULL, DNS_TRANSACTION_NULL,
DNS_TRANSACTION_PENDING, DNS_TRANSACTION_PENDING,
@ -37,13 +45,6 @@ enum DnsTransactionSource {
_DNS_TRANSACTION_SOURCE_INVALID = -1 _DNS_TRANSACTION_SOURCE_INVALID = -1
}; };
#include "resolved-dns-answer.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-scope.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h"
struct DnsTransaction { struct DnsTransaction {
DnsScope *scope; DnsScope *scope;

View File

@ -6,6 +6,7 @@
#include "resolved-dns-packet.h" #include "resolved-dns-packet.h"
#include "resolved-dns-zone.h" #include "resolved-dns-zone.h"
#include "resolved-dnssd.h" #include "resolved-dnssd.h"
#include "resolved-manager.h"
#include "string-util.h" #include "string-util.h"
/* Never allow more than 1K entries */ /* Never allow more than 1K entries */

View File

@ -6,6 +6,7 @@
#include "resolved-dnssd-bus.h" #include "resolved-dnssd-bus.h"
#include "resolved-dnssd.h" #include "resolved-dnssd.h"
#include "resolved-link.h" #include "resolved-link.h"
#include "resolved-manager.h"
#include "strv.h" #include "strv.h"
#include "user-util.h" #include "user-util.h"

View File

@ -8,6 +8,7 @@
#include "resolved-dns-stream.h" #include "resolved-dns-stream.h"
#include "resolved-dnstls.h" #include "resolved-dnstls.h"
#include "resolved-manager.h"
#define TLS_PROTOCOL_PRIORITY "NORMAL:-VERS-ALL:+VERS-TLS1.3:+VERS-TLS1.2" #define TLS_PROTOCOL_PRIORITY "NORMAL:-VERS-ALL:+VERS-TLS1.3:+VERS-TLS1.2"
DEFINE_TRIVIAL_CLEANUP_FUNC(gnutls_session_t, gnutls_deinit); DEFINE_TRIVIAL_CLEANUP_FUNC(gnutls_session_t, gnutls_deinit);

View File

@ -11,6 +11,7 @@
#include "io-util.h" #include "io-util.h"
#include "resolved-dns-stream.h" #include "resolved-dns-stream.h"
#include "resolved-dnstls.h" #include "resolved-dnstls.h"
#include "resolved-manager.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(SSL*, SSL_free); DEFINE_TRIVIAL_CLEANUP_FUNC(SSL*, SSL_free);
DEFINE_TRIVIAL_CLEANUP_FUNC(BIO*, BIO_free); DEFINE_TRIVIAL_CLEANUP_FUNC(BIO*, BIO_free);

View File

@ -3,9 +3,14 @@
#if ENABLE_DNS_OVER_TLS #if ENABLE_DNS_OVER_TLS
#include <stdint.h>
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsTlsManagerData DnsTlsManagerData; typedef struct DnsTlsManagerData DnsTlsManagerData;
typedef struct DnsTlsServerData DnsTlsServerData; typedef struct DnsTlsServerData DnsTlsServerData;
typedef struct DnsTlsStreamData DnsTlsStreamData; typedef struct DnsTlsStreamData DnsTlsStreamData;
typedef struct Manager Manager;
#if DNS_OVER_TLS_USE_GNUTLS #if DNS_OVER_TLS_USE_GNUTLS
#include "resolved-dnstls-gnutls.h" #include "resolved-dnstls-gnutls.h"
@ -15,10 +20,6 @@ typedef struct DnsTlsStreamData DnsTlsStreamData;
#error Unknown dependency for supporting DNS-over-TLS #error Unknown dependency for supporting DNS-over-TLS
#endif #endif
#include "resolved-dns-stream.h"
#include "resolved-dns-transaction.h"
#include "resolved-manager.h"
#define DNSTLS_STREAM_CLOSED 1 #define DNSTLS_STREAM_CLOSED 1
int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server); int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server);

View File

@ -5,6 +5,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#include <stddef.h> #include <stddef.h>
#include "conf-parser.h" #include "conf-parser.h"
#include "resolved-conf.h" #include "resolved-conf.h"
#include "resolved-manager.h"
%} %}
struct ConfigPerfItem; struct ConfigPerfItem;
%null_strings %null_strings

View File

@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */ /* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once #pragma once
#include "sd-netlink.h"
#include "in-addr-util.h" #include "in-addr-util.h"
#include "ratelimit.h" #include "ratelimit.h"
#include "resolve-util.h" #include "resolve-util.h"
@ -12,7 +14,6 @@ typedef struct LinkAddress LinkAddress;
#include "resolved-dns-scope.h" #include "resolved-dns-scope.h"
#include "resolved-dns-search-domain.h" #include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h" #include "resolved-dns-server.h"
#include "resolved-manager.h"
#define LINK_SEARCH_DOMAINS_MAX 256 #define LINK_SEARCH_DOMAINS_MAX 256
#define LINK_DNS_SERVERS_MAX 256 #define LINK_DNS_SERVERS_MAX 256

View File

@ -15,10 +15,8 @@ typedef struct Manager Manager;
#include "resolved-conf.h" #include "resolved-conf.h"
#include "resolved-dns-query.h" #include "resolved-dns-query.h"
#include "resolved-dns-search-domain.h" #include "resolved-dns-search-domain.h"
#include "resolved-dns-server.h"
#include "resolved-dns-stream.h" #include "resolved-dns-stream.h"
#include "resolved-dns-trust-anchor.h" #include "resolved-dns-trust-anchor.h"
#include "resolved-dnstls.h"
#include "resolved-link.h" #include "resolved-link.h"
#define MANAGER_SEARCH_DOMAINS_MAX 256 #define MANAGER_SEARCH_DOMAINS_MAX 256

View File

@ -1013,10 +1013,14 @@ static int install_info_add(
int r; int r;
assert(c); assert(c);
assert(name || path);
if (!name) if (!name) {
/* 'name' and 'path' must not both be null. Check here 'path' using assert_se() to
* workaround a bug in gcc that generates a -Wnonnull warning when calling basename(),
* but this cannot be possible in any code path (See #6119). */
assert_se(path);
name = basename(path); name = basename(path);
}
if (!unit_name_is_valid(name, UNIT_NAME_ANY)) if (!unit_name_is_valid(name, UNIT_NAME_ANY))
return -EINVAL; return -EINVAL;

View File

@ -15,7 +15,6 @@
int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) { int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
struct statfs sfs; struct statfs sfs;
int r;
assert(fd >= 0); assert(fd >= 0);
@ -54,8 +53,7 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
sz -= sz % sfs.f_bsize; sz -= sz % sfs.f_bsize;
r = snprintf(args.name, sizeof(args.name), "%" PRIu64, sz); xsprintf(args.name, "%" PRIu64, sz);
assert((size_t) r < sizeof(args.name));
if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0) if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0)
return -errno; return -errno;

View File

@ -340,12 +340,30 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
if (hr->disk_usage != UINT64_MAX) { if (hr->disk_usage != UINT64_MAX) {
char buf[FORMAT_BYTES_MAX]; char buf[FORMAT_BYTES_MAX];
printf(" Disk Usage: %s\n", format_bytes(buf, sizeof(buf), hr->disk_usage));
if (hr->disk_size != UINT64_MAX) {
unsigned permille;
permille = (unsigned) DIV_ROUND_UP(hr->disk_usage * 1000U, hr->disk_size); /* Round up! */
printf(" Disk Usage: %s (= %u.%01u%%)\n",
format_bytes(buf, sizeof(buf), hr->disk_usage),
permille / 10, permille % 10);
} else
printf(" Disk Usage: %s\n", format_bytes(buf, sizeof(buf), hr->disk_usage));
} }
if (hr->disk_free != UINT64_MAX) { if (hr->disk_free != UINT64_MAX) {
char buf[FORMAT_BYTES_MAX]; char buf[FORMAT_BYTES_MAX];
printf(" Disk Free: %s\n", format_bytes(buf, sizeof(buf), hr->disk_free));
if (hr->disk_size != UINT64_MAX) {
unsigned permille;
permille = (unsigned) ((hr->disk_free * 1000U) / hr->disk_size); /* Round down! */
printf(" Disk Free: %s (= %u.%01u%%)\n",
format_bytes(buf, sizeof(buf), hr->disk_free),
permille / 10, permille % 10);
} else
printf(" Disk Free: %s\n", format_bytes(buf, sizeof(buf), hr->disk_free));
} }
if (hr->disk_floor != UINT64_MAX) { if (hr->disk_floor != UINT64_MAX) {

View File

@ -99,13 +99,13 @@ static void test_bool_assign(void) {
g = cp; /* cast from pointer */ g = cp; /* cast from pointer */
h = NULL; /* cast from pointer */ h = NULL; /* cast from pointer */
assert(b); assert_se(b);
assert(c); assert_se(c);
assert(d); assert_se(d);
assert(e); assert_se(e);
assert(!f); assert_se(!f);
assert(g); assert_se(g);
assert(!h); assert_se(!h);
} }
static int cleanup_counter = 0; static int cleanup_counter = 0;

View File

@ -233,17 +233,17 @@ static void assert_equal_fd(int fd1, int fd2) {
ssize_t x, y; ssize_t x, y;
x = read(fd1, a, sizeof(a)); x = read(fd1, a, sizeof(a));
assert(x >= 0); assert_se(x >= 0);
y = read(fd2, b, sizeof(b)); y = read(fd2, b, sizeof(b));
assert(y >= 0); assert_se(y >= 0);
assert(x == y); assert_se(x == y);
if (x == 0) if (x == 0)
break; break;
assert(memcmp(a, b, x) == 0); assert_se(memcmp(a, b, x) == 0);
} }
} }

View File

@ -433,7 +433,7 @@ static void assert_similar(usec_t a, usec_t b) {
else else
d = b - a; d = b - a;
assert(d < 10*USEC_PER_SEC); assert_se(d < 10*USEC_PER_SEC);
} }
static void test_usec_shift_clock(void) { static void test_usec_shift_clock(void) {