opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

0004-Avoid-empty-initializer-lists.patch (7492B)


      1 From 463e94867f84bcb4dc85e18cb4304edea90d8659 Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Sat, 6 Jul 2019 01:54:05 -0700
      4 Subject: [PATCH] Avoid empty initializer lists
      5 
      6 ---
      7  src/bpf.c               | 4 ++--
      8  src/futex_waitv.c       | 2 +-
      9  src/sched.c             | 2 +-
     10  src/signal.c            | 2 +-
     11  src/strace.c            | 2 +-
     12  tests/btrfs.c           | 8 ++++----
     13  tests/clock_nanosleep.c | 2 +-
     14  tests/nanosleep.c       | 2 +-
     15  tests/restart_syscall.c | 2 +-
     16  tests/setrlimit.c       | 2 +-
     17  tests/timer_create.c    | 2 +-
     18  tests/wait4.c           | 2 +-
     19  tests/waitid.c          | 2 +-
     20  13 files changed, 17 insertions(+), 17 deletions(-)
     21 
     22 diff --git a/src/bpf.c b/src/bpf.c
     23 index 1e72f3e30..7a6406687 100644
     24 --- a/src/bpf.c
     25 +++ b/src/bpf.c
     26 @@ -48,7 +48,7 @@ bpf_cmd_decoder(struct tcb *const tcp,					\
     27  #define BEGIN_BPF_CMD_DECODER(bpf_cmd)					\
     28  	static DECL_BPF_CMD_DECODER(decode_ ## bpf_cmd)			\
     29  	{								\
     30 -		struct bpf_cmd ## _struct attr = {};			\
     31 +		struct bpf_cmd ## _struct attr = {0};			\
     32  		size_t attr_size = bpf_cmd ## _struct_size;	\
     33  		const unsigned int len = MIN(size, attr_size);		\
     34  		memcpy(&attr, data, len);				\
     35 @@ -159,7 +159,7 @@ print_ebpf_prog(struct tcb *const tcp, const uint64_t addr, const uint32_t len)
     36  	if (abbrev(tcp)) {
     37  		printaddr(addr);
     38  	} else {
     39 -		struct ebpf_insns_data eid = {};
     40 +		struct ebpf_insns_data eid = {0};
     41  		struct ebpf_insn insn;
     42  
     43  		print_array(tcp, addr, len, &insn, sizeof(insn),
     44 diff --git a/src/futex_waitv.c b/src/futex_waitv.c
     45 index 512ee715d..340201aa3 100644
     46 --- a/src/futex_waitv.c
     47 +++ b/src/futex_waitv.c
     48 @@ -49,7 +49,7 @@ print_waiter_array(struct tcb * const tcp, const kernel_ulong_t waiters,
     49  		   const unsigned int nr_futexes)
     50  {
     51  	struct futex_waitv buf;
     52 -	struct print_waiter_data data = {};
     53 +	struct print_waiter_data data = {0};
     54  
     55  	print_array(tcp, waiters, nr_futexes, &buf, sizeof(buf),
     56  		    tfetch_mem, print_waiter, &data);
     57 diff --git a/src/sched.c b/src/sched.c
     58 index 010366871..2dda5b872 100644
     59 --- a/src/sched.c
     60 +++ b/src/sched.c
     61 @@ -111,7 +111,7 @@ static void
     62  print_sched_attr(struct tcb *const tcp, const kernel_ulong_t addr,
     63  		 unsigned int usize)
     64  {
     65 -	struct sched_attr attr = {};
     66 +	struct sched_attr attr = {0};
     67  	unsigned int size;
     68  	bool is_set = false;
     69  
     70 diff --git a/src/signal.c b/src/signal.c
     71 index 98f84d500..8680b10fb 100644
     72 --- a/src/signal.c
     73 +++ b/src/signal.c
     74 @@ -257,7 +257,7 @@ print_sigset_addr_len_limit(struct tcb *const tcp, const kernel_ulong_t addr,
     75  		printaddr(addr);
     76  		return;
     77  	}
     78 -	int mask[NSIG_BYTES / sizeof(int)] = {};
     79 +	int mask[NSIG_BYTES / sizeof(int)] = {0};
     80  	if (umoven_or_printaddr(tcp, addr, len, mask))
     81  		return;
     82  	tprints_string(sprintsigmask_n("", mask, len));
     83 diff --git a/src/strace.c b/src/strace.c
     84 index 5752177b7..9cd4ff461 100644
     85 --- a/src/strace.c
     86 +++ b/src/strace.c
     87 @@ -3693,7 +3693,7 @@ trace_syscall(struct tcb *tcp, unsigned int *sig)
     88  		syscall_entering_finish(tcp, res);
     89  		return res;
     90  	} else {
     91 -		struct timespec ts = {};
     92 +		struct timespec ts = {0};
     93  		int res = syscall_exiting_decode(tcp, &ts);
     94  		if (res != 0) {
     95  			res = syscall_exiting_trace(tcp, &ts, res);
     96 diff --git a/tests/btrfs.c b/tests/btrfs.c
     97 index 321d3a25c..442377130 100644
     98 --- a/tests/btrfs.c
     99 +++ b/tests/btrfs.c
    100 @@ -313,7 +313,7 @@ btrfs_test_subvol_ioctls(void)
    101  	char *long_subvol_name;
    102  	void *bad_pointer = (void *) (unsigned long) 0xdeadbeeffffffeedULL;
    103  	uint64_t u64val = 0xdeadbeefbadc0dedULL;
    104 -	struct btrfs_ioctl_vol_args vol_args = {};
    105 +	struct btrfs_ioctl_vol_args vol_args = {0};
    106  	struct btrfs_ioctl_vol_args_v2 vol_args_v2 = {
    107  		.fd = 2,
    108  		.flags = max_flags_plus_one(2),
    109 @@ -554,7 +554,7 @@ btrfs_test_balance_ioctls(void)
    110  			.devid = 1,
    111  		},
    112  	};
    113 -	struct btrfs_ioctl_vol_args vol_args = {};
    114 +	struct btrfs_ioctl_vol_args vol_args = {0};
    115  
    116  	ioctl(-1, BTRFS_IOC_BALANCE_CTL, 1);
    117  	printf("ioctl(-1, %s, %sBTRFS_BALANCE_CTL_PAUSE%s) = -1 EBADF (%m)\n",
    118 @@ -764,7 +764,7 @@ btrfs_print_defrag_range_args(struct btrfs_ioctl_defrag_range_args *args,
    119  static void
    120  btrfs_test_defrag_ioctls(void)
    121  {
    122 -	struct btrfs_ioctl_vol_args vol_args = {};
    123 +	struct btrfs_ioctl_vol_args vol_args = {0};
    124  	struct btrfs_ioctl_defrag_range_args args = {
    125  		.start = 0,
    126  		.len = -1ULL,
    127 @@ -1092,7 +1092,7 @@ btrfs_test_ino_lookup_ioctl(void)
    128  static void
    129  btrfs_test_space_info_ioctl(void)
    130  {
    131 -	struct btrfs_ioctl_space_args args = {};
    132 +	struct btrfs_ioctl_space_args args = {0};
    133  
    134  	ioctl(-1, BTRFS_IOC_SPACE_INFO, NULL);
    135  	printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n",
    136 diff --git a/tests/clock_nanosleep.c b/tests/clock_nanosleep.c
    137 index 51bd0d7f7..a1053fd1e 100644
    138 --- a/tests/clock_nanosleep.c
    139 +++ b/tests/clock_nanosleep.c
    140 @@ -39,7 +39,7 @@ main(void)
    141  		.ts = { .tv_sec = 0xc0de2, .tv_nsec = 0xc0de3 },
    142  		.pad = { 0xdeadbeef, 0xbadc0ded }
    143  	};
    144 -	const sigset_t set = {};
    145 +	const sigset_t set = {0};
    146  	const struct sigaction act = { .sa_handler = handler };
    147  	const struct itimerval itv = {
    148  		.it_interval.tv_usec = 222222,
    149 diff --git a/tests/nanosleep.c b/tests/nanosleep.c
    150 index 8ff6a86b8..6377f38ee 100644
    151 --- a/tests/nanosleep.c
    152 +++ b/tests/nanosleep.c
    153 @@ -53,7 +53,7 @@ main(void)
    154  		.ts = { .tv_sec = 0xc0de2, .tv_nsec = 0xc0de3 },
    155  		.pad = { 0xdeadbeef, 0xbadc0ded }
    156  	};
    157 -	const sigset_t set = {};
    158 +	const sigset_t set = {0};
    159  	const struct sigaction act = { .sa_handler = handler };
    160  	const struct itimerval itv = { .it_value.tv_usec = 111111 };
    161  
    162 diff --git a/tests/restart_syscall.c b/tests/restart_syscall.c
    163 index e4e83dc09..da83d1dc7 100644
    164 --- a/tests/restart_syscall.c
    165 +++ b/tests/restart_syscall.c
    166 @@ -26,7 +26,7 @@ main(void)
    167  	 */
    168  	error_msg_and_skip("x32 is broken");
    169  #else
    170 -	const sigset_t set = {};
    171 +	const sigset_t set = {0};
    172  	const struct sigaction act = { .sa_handler = SIG_IGN };
    173  	const struct itimerval itv = { .it_value.tv_usec = 111111 };
    174  	const struct timespec req = { .tv_nsec = 222222222 };
    175 diff --git a/tests/setrlimit.c b/tests/setrlimit.c
    176 index d4953f6f8..60d54fbd8 100644
    177 --- a/tests/setrlimit.c
    178 +++ b/tests/setrlimit.c
    179 @@ -39,7 +39,7 @@ main(void)
    180  		printf("setrlimit(%s, NULL) = %s\n", xlat->str, sprintrc(rc));
    181  # endif
    182  
    183 -		struct rlimit libc_rlim = {};
    184 +		struct rlimit libc_rlim = {0};
    185  		if (getrlimit((int) res, &libc_rlim))
    186  			continue;
    187  		rlimit[0] = libc_rlim.rlim_cur;
    188 diff --git a/tests/timer_create.c b/tests/timer_create.c
    189 index af91da0d3..a0a79f1ad 100644
    190 --- a/tests/timer_create.c
    191 +++ b/tests/timer_create.c
    192 @@ -24,7 +24,7 @@ main(void)
    193  	printf("timer_create(CLOCK_REALTIME, NULL, NULL) = -1 %s (%m)\n",
    194  	       errno2name());
    195  
    196 -	int tid[4] = {};
    197 +	int tid[4] = {0};
    198  	struct_sigevent sev = {
    199  		.sigev_notify = 0xdefaced,
    200  		.sigev_signo = 0xfacefeed,
    201 diff --git a/tests/wait4.c b/tests/wait4.c
    202 index faf9423f8..eacee2366 100644
    203 --- a/tests/wait4.c
    204 +++ b/tests/wait4.c
    205 @@ -89,7 +89,7 @@ k_wait4(const unsigned int pid, void const *wstatus,
    206  static pid_t
    207  do_wait4(pid_t pid, int *wstatus, int options, kernel_rusage_t *ru)
    208  {
    209 -	sigset_t mask = {};
    210 +	sigset_t mask = {0};
    211  	sigaddset(&mask, SIGCHLD);
    212  
    213  	assert(sigprocmask(SIG_BLOCK, &mask, NULL) == 0);
    214 diff --git a/tests/waitid.c b/tests/waitid.c
    215 index 1ed763840..fef941874 100644
    216 --- a/tests/waitid.c
    217 +++ b/tests/waitid.c
    218 @@ -146,7 +146,7 @@ do_waitid(const unsigned int idtype,
    219  	  const unsigned int options,
    220  	  const kernel_rusage_t *const rusage)
    221  {
    222 -	sigset_t mask = {};
    223 +	sigset_t mask = {0};
    224  	sigaddset(&mask, SIGCHLD);
    225  
    226  	assert(sigprocmask(SIG_BLOCK, &mask, NULL) == 0);
    227 -- 
    228 2.37.3
    229