]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Delete duplicate lines
authorTopi Miettinen <toiwoton@gmail.com>
Sat, 5 Jan 2019 18:37:34 +0000 (20:37 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 12 Jan 2019 15:02:26 +0000 (16:02 +0100)
Found by inspecting results of running this small program:

int main(int argc, const char **argv) {
for (int i = 1; i < argc; i++) {
FILE *f;
char line[1024], prev[1024], *r;
int lineno;

prev[0] = '\0';
lineno = 1;
f = fopen(argv[i], "r");
if (!f)
exit(1);
do {
r = fgets(line, sizeof(line), f);
if (!r)
break;
if (strcmp(line, prev) == 0)
printf("%s:%d: error: dup %s", argv[i], lineno, line);
lineno++;
strcpy(prev, line);
} while (!feof(f));
fclose(f);
}
}

16 files changed:
src/analyze/analyze-security.c
src/basic/hashmap.h
src/core/bpf-devices.c
src/journal/journald-wall.h
src/journal/sd-journal.c
src/libsystemd-network/sd-ndisc.c
src/libsystemd/sd-resolve/sd-resolve.c
src/network/networkd-dhcp6.c
src/systemd/sd-netlink.h
src/test/test-hexdecoct.c
src/test/test-json.c
src/test/test-mountpoint-util.c
src/test/test-stat-util.c
src/test/test-time-util.c
src/udev/udev-builtin-path_id.c
src/udev/udevadm-info.c

index 1fc3c1e02f06edca705a41fa46d9bffa4b8cbd8d..3c732b712db8a8d48effa821d1a38c9f39546145 100644 (file)
@@ -1859,7 +1859,6 @@ static int acquire_security_info(sd_bus *bus, const char *name, struct security_
                 { "PrivateNetwork",          "b",       NULL,                                    offsetof(struct security_info, private_network)           },
                 { "PrivateTmp",              "b",       NULL,                                    offsetof(struct security_info, private_tmp)               },
                 { "PrivateUsers",            "b",       NULL,                                    offsetof(struct security_info, private_users)             },
-                { "PrivateUsers",            "b",       NULL,                                    offsetof(struct security_info, private_users)             },
                 { "ProtectControlGroups",    "b",       NULL,                                    offsetof(struct security_info, protect_control_groups)    },
                 { "ProtectHome",             "s",       NULL,                                    offsetof(struct security_info, protect_home)              },
                 { "ProtectKernelModules",    "b",       NULL,                                    offsetof(struct security_info, protect_kernel_modules)    },
index 5bf807a76f55edc9a4b143d4975ebc29cc08760b..e16a9f9e30c84b9134853e4d476543aef78811d0 100644 (file)
@@ -326,7 +326,6 @@ static inline void *ordered_hashmap_first_key_and_value(OrderedHashmap *h, void
         return internal_hashmap_first_key_and_value(HASHMAP_BASE(h), false, ret);
 }
 
-
 static inline void *hashmap_steal_first(Hashmap *h) {
         return internal_hashmap_first_key_and_value(HASHMAP_BASE(h), true, NULL);
 }
index dade7f04906a64a7fc898d5d2314934e8f308212..81e91fcb3625dff12b3e4d0f25e944ec3840c06e 100644 (file)
@@ -202,7 +202,6 @@ int cgroup_apply_device_bpf(Unit *u, BPFProgram *prog, CGroupDevicePolicy policy
         if (r < 0)
                 return log_error_errno(r, "Failed to determine cgroup path: %m");
 
-
         r = bpf_program_cgroup_attach(prog, BPF_CGROUP_DEVICE, path, BPF_F_ALLOW_MULTI);
         if (r < 0)
                 return log_error_errno(r, "Attaching device control BPF program to cgroup %s failed: %m", path);
index d081c8254ccbcbb291366b797ac48be5096bcde4..b73059af46663d109adcd2cff75c24601c57b583 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
-
 #include "journald-server.h"
 
 void server_forward_wall(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred);
index b5ff5b64f33352f644f7cce3ff4e4eb4831614ed..0f996283cdf7a29a0ef7eb34abcec32a98ea54dc 100644 (file)
@@ -36,7 +36,6 @@
 #include "process-util.h"
 #include "replace-var.h"
 #include "stat-util.h"
-#include "stat-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
 #include "strv.h"
index 79b2ea8bf25d3592510cc6aa603356d44ad88e06..32c20b1e4afa5c8cd389eb91847351543769286b 100644 (file)
@@ -34,7 +34,6 @@ static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event event, sd_ndisc_route
         assert(ndisc);
         assert(event >= 0 && event < _SD_NDISC_EVENT_MAX);
 
-
         if (!ndisc->callback) {
                 log_ndisc("Received '%s' event.", ndisc_event_to_string(event));
                 return;
index 21d783b8f00fa7ba16bd2e8b6965fc8d152437c0..36b9c8d0196d361f0b1edc06a74370a96ae998eb 100644 (file)
@@ -912,7 +912,6 @@ static int alloc_query(sd_resolve *resolve, bool floating, sd_resolve_query **_q
         return 0;
 }
 
-
 int resolve_getaddrinfo_with_destroy_callback(
                 sd_resolve *resolve,
                 sd_resolve_query **ret_query,
index ed6b9df72badd3cd4112127ddd2a7b34ec3629c4..f9df26d75e08f029d4f41062dd2ae5f36cafa243 100644 (file)
@@ -254,7 +254,6 @@ static int dhcp6_route_handler(sd_netlink *nl, sd_netlink_message *m, Link *link
         return 1;
 }
 
-
 static int dhcp6_lease_pd_prefix_acquired(sd_dhcp6_client *client, Link *link) {
         int r;
         sd_dhcp6_lease *lease;
index 30be5b113ca36e6c40241b72873536cebd37272a..a97a965ec403f706a9c99c88e558a9e5f2edc8df 100644 (file)
@@ -200,7 +200,6 @@ int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b);
 int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description);
 int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description);
 
-
 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref);
 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_message, sd_netlink_message_unref);
 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink_slot, sd_netlink_slot_unref);
index 6e9b94b93314fee193c5dfc53031be5b4fea772f..52217429b1541e9d0de87ba3752acf0c0509e249 100644 (file)
@@ -233,7 +233,6 @@ static void test_unbase32hexmem(void) {
         test_unbase32hexmem_one("CPNMUOG=", false, -EINVAL, NULL);
         test_unbase32hexmem_one("CPNMUOJ1E8======", false, -EINVAL, NULL);
 
-        test_unbase32hexmem_one("A", false, -EINVAL, NULL);
         test_unbase32hexmem_one("A", false, -EINVAL, NULL);
         test_unbase32hexmem_one("AAA", false, -EINVAL, NULL);
         test_unbase32hexmem_one("AAAAAA", false, -EINVAL, NULL);
index cd6269f798f5b8f387a9f175260dc78e69c4123d..9a9b01aa1832fb4f15cb211846435091fb2c8232 100644 (file)
@@ -209,7 +209,6 @@ static void test_2(JsonVariant *v) {
         assert_se(p && json_variant_type(p) == JSON_VARIANT_REAL && fabsl(json_variant_real(p) - 1.27) < 0.001);
 }
 
-
 static void test_zeroes(JsonVariant *v) {
         size_t i;
 
index 6d8bee0d633b7151099b1ce11104293c5fee0352..8e45c0b1a7a8a167968c2658770a20c1caa49fbf 100644 (file)
@@ -8,7 +8,6 @@
 #include "fileio.h"
 #include "hashmap.h"
 #include "log.h"
-#include "log.h"
 #include "mountpoint-util.h"
 #include "path-util.h"
 #include "rm-rf.h"
index d16fdd90d1bc2898bad5a31198831b3923515769..0e2155e91134cc3ca4871b462a357ba83152dfeb 100644 (file)
@@ -56,7 +56,6 @@ static void test_path_is_fs_type(void) {
         }
         assert_se(path_is_fs_type("/proc", PROC_SUPER_MAGIC) > 0);
         assert_se(path_is_fs_type("/proc", BTRFS_SUPER_MAGIC) == 0);
-        assert_se(path_is_fs_type("/proc", BTRFS_SUPER_MAGIC) == 0);
         assert_se(path_is_fs_type("/i-dont-exist", BTRFS_SUPER_MAGIC) == -ENOENT);
 }
 
index 2ec2ade3f18e155d85501e276b54d4adf4a5137e..eb6041c152de5cb7a30478abac5fa16302d33a5a 100644 (file)
@@ -212,7 +212,6 @@ static void test_format_timespan(usec_t accuracy) {
         test_format_timespan_one(12345678, accuracy);
         test_format_timespan_one(1200000, accuracy);
         test_format_timespan_one(1230000, accuracy);
-        test_format_timespan_one(1230000, accuracy);
         test_format_timespan_one(1234000, accuracy);
         test_format_timespan_one(1234500, accuracy);
         test_format_timespan_one(1234560, accuracy);
@@ -289,7 +288,6 @@ static void test_usec_sub_signed(void) {
         assert_se(usec_sub_signed(4, 4) == 0);
         assert_se(usec_sub_signed(4, 5) == 0);
         assert_se(usec_sub_signed(USEC_INFINITY-3, -3) == USEC_INFINITY);
-        assert_se(usec_sub_signed(USEC_INFINITY-3, -3) == USEC_INFINITY);
         assert_se(usec_sub_signed(USEC_INFINITY-3, -4) == USEC_INFINITY);
         assert_se(usec_sub_signed(USEC_INFINITY-3, -5) == USEC_INFINITY);
         assert_se(usec_sub_signed(USEC_INFINITY, 5) == USEC_INFINITY);
index 94f2740592da33d384a004dd65081385e5ae38e4..7ce1c5644fd0a63f7fe894181db78726f59af1bb 100644 (file)
@@ -110,7 +110,6 @@ static sd_device *handle_scsi_fibre_channel(sd_device *parent, char **path) {
         assert(parent);
         assert(path);
 
-
         if (sd_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target", &targetdev) < 0)
                 return NULL;
         if (sd_device_get_sysname(targetdev, &sysname) < 0)
index d141bc74b2a10fc91d255c687b9659cfeaf6504c..140950df6201ccc321f8ecbdb11284652c8fa38e 100644 (file)
@@ -425,7 +425,6 @@ int info_main(int argc, char *argv[], void *userdata) {
                         assert_not_reached("Unknown option");
                 }
 
-
         if (action == ACTION_DEVICE_ID_FILE) {
                 if (argv[optind])
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),