opkg

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

0007-Don-t-omit-second-operand-to-operator.patch (3156B)


      1 From 3b3898e2a370be0489226da973e18176530e267a Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Sun, 7 Jul 2019 21:53:16 -0700
      4 Subject: [PATCH] Don't omit second operand to '?' operator
      5 
      6 ---
      7  src/kd_ioctl.c | 2 +-
      8  src/open.c     | 5 +++--
      9  src/prctl.c    | 8 ++++----
     10  src/strace.c   | 6 +++---
     11  4 files changed, 11 insertions(+), 10 deletions(-)
     12 
     13 diff --git a/src/kd_ioctl.c b/src/kd_ioctl.c
     14 index ada23d536..fddbd38fb 100644
     15 --- a/src/kd_ioctl.c
     16 +++ b/src/kd_ioctl.c
     17 @@ -457,7 +457,7 @@ kd_kbd_str_entry(struct tcb *const tcp, const kernel_ulong_t arg,
     18  
     19  	if (print_quoted_string((char *) val.kb_string,
     20  				MIN(max_strlen,
     21 -				   (unsigned int) ret ?: sizeof(val.kb_string)),
     22 +				   ret ? (unsigned int) ret : sizeof(val.kb_string)),
     23  				QUOTE_OMIT_TRAILING_0))
     24  		tprint_more_data_follows();
     25  
     26 diff --git a/src/open.c b/src/open.c
     27 index 6356c5831..df59ea999 100644
     28 --- a/src/open.c
     29 +++ b/src/open.c
     30 @@ -88,8 +88,9 @@ sprint_open_modes64(uint64_t flags)
     31  	}
     32  	*p = '\0';
     33  
     34 -	return sprintflags_ex(outstr, open_mode_flags, flags, sep,
     35 -			      XLAT_STYLE_ABBREV) ?: outstr;
     36 +	str = sprintflags_ex(outstr, open_mode_flags, flags, sep,
     37 +			     XLAT_STYLE_ABBREV);
     38 +	return str ? str : outstr;
     39  }
     40  
     41  const char *
     42 diff --git a/src/prctl.c b/src/prctl.c
     43 index f6b4dd741..951133a83 100644
     44 --- a/src/prctl.c
     45 +++ b/src/prctl.c
     46 @@ -92,10 +92,10 @@ sprint_sve_val(kernel_ulong_t arg, bool aux)
     47  	if (!aux && flags && xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
     48  	{
     49  		xsprintf(out, "%#" PRI_klx " /* %s%s%#" PRI_klx " */",
     50 -			 arg, flags_str ?: "", flags_str ? "|" : "", vl);
     51 +			 arg, flags_str ? flags_str : "", flags_str ? "|" : "", vl);
     52  	} else {
     53  		xsprintf(out, "%s%s%#" PRI_klx,
     54 -			 flags_str ?: "", flags_str ? "|" : "", vl);
     55 +			 flags_str ? flags_str : "", flags_str ? "|" : "", vl);
     56  	}
     57  
     58  	return out;
     59 @@ -128,10 +128,10 @@ sprint_sme_val(kernel_ulong_t arg, bool aux)
     60  	if (!aux && flags && xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
     61  	{
     62  		xsprintf(out, "%#" PRI_klx " /* %s%s%#" PRI_klx " */",
     63 -			 arg, flags_str ?: "", flags_str ? "|" : "", vl);
     64 +			 arg, flags_str ? flags_str : "", flags_str ? "|" : "", vl);
     65  	} else {
     66  		xsprintf(out, "%s%s%#" PRI_klx,
     67 -			 flags_str ?: "", flags_str ? "|" : "", vl);
     68 +			 flags_str ? flags_str : "", flags_str ? "|" : "", vl);
     69  	}
     70  
     71  	return out;
     72 diff --git a/src/strace.c b/src/strace.c
     73 index 9cd4ff461..4403bd27e 100644
     74 --- a/src/strace.c
     75 +++ b/src/strace.c
     76 @@ -2494,7 +2494,7 @@ init(int argc, char *argv[])
     77  			break;
     78  		case GETOPT_TS:
     79  			tflag_long_set = true;
     80 -			if (parse_ts_arg(optarg ?: tflag_str))
     81 +			if (parse_ts_arg(optarg ? optarg : tflag_str))
     82  				error_opt_arg(c, lopt, optarg);
     83  			break;
     84  		case 'T':
     85 @@ -2614,10 +2614,10 @@ init(int argc, char *argv[])
     86  			qualify_kvm(optarg);
     87  			break;
     88  		case GETOPT_QUAL_QUIET:
     89 -			qualify_quiet(optarg ?: qflag_qual);
     90 +			qualify_quiet(optarg ? optarg : qflag_qual);
     91  			break;
     92  		case GETOPT_QUAL_DECODE_FD:
     93 -			qualify_decode_fd(optarg ?: yflag_qual);
     94 +			qualify_decode_fd(optarg ? optarg : yflag_qual);
     95  			break;
     96  		case GETOPT_QUAL_DECODE_PID:
     97  			qualify_decode_pid(optarg);
     98 -- 
     99 2.37.3
    100