Re: [PATCH 3/3] lsirq,irqtop: add support for reading data from given file

Karel Zak <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <tzkpkjopbtqlpmeic2xoephezgfl63xa5e4eytycmg24cbnx4q@qamwltb7ol6y>
On Wed, Feb 26, 2025 at 08:49:16PM GMT, Joe Jin wrote:
> +	if (ctl->input == NULL) {
> +		if (ctl->softirq == 1)
> +			ctl->input = strdup(_PATH_PROC_SOFTIRQS);
> +		else
> +			ctl->input = strdup(_PATH_PROC_INTERRUPTS);
> +		if (!ctl->input)
> +			err_oom();
> +	}

 Please, use xstrdup(), than you do not need to care about result and
 use err_oom();

    Karel
-- 
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.