lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 20 May 2015 14:23:17 -0700
From:	Cong Wang <cwang@...pensource.com>
To:	Jesper Dangaard Brouer <brouer@...hat.com>
Cc:	netdev <netdev@...r.kernel.org>,
	Daniel Borkmann <borkmann@...earbox.net>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Robert Olsson <robert@...julf.se>,
	Ben Greear <greearb@...delatech.com>
Subject: Re: [net-next PATCH 06/10] pktgen: new pktgen helper functions for
 samples scripts

On Tue, May 19, 2015 at 2:36 PM, Jesper Dangaard Brouer
<brouer@...hat.com> wrote:
> +
> +# More generic replacement for pgset(), that does not depend on global
> +# variable for proc file.
> +function proc_cmd() {
> +    local result
> +    local proc_file=$1
> +    # after shift, the remaining args are contained in $@
> +    shift
> +    local proc_ctrl=${PROC_DIR}/$proc_file
> +    if [[ ! -e "$proc_ctrl" ]]; then
> +       err 3 "proc file:$proc_ctrl does not exists (dev added to thread?)"
> +    else
> +       if [[ ! -w "$proc_ctrl" ]]; then
> +           err 4 "proc file:$proc_ctrl not writable, not root?!"
> +       fi
> +    fi
> +
> +    if [[ "$DEBUG" == "yes" ]]; then
> +       echo "cmd: $@ > $proc_ctrl"
> +    fi
> +    # Quoting of "$@" is important for space expansion
> +    echo "$@" > "$proc_ctrl"
> +    local status=$?
> +
> +    result=`cat $proc_ctrl | fgrep "Result: OK:"`

Nit: useless usage of cat, grep/fgrep accepts a file name.


> +    if [[ "$result" == "" ]]; then

You can test $?

> +       cat $proc_ctrl | fgrep Result: >&2
> +    fi
> +    if (( $status != 0 )); then
> +       err 5 "Write error($status) occured cmd: \"$@ > $proc_ctrl\""

Typo: occurred


> +    fi
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ