All of lore.kernel.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Cc: kexec@lists.infradead.org
Subject: Re: [PATCH] makedumpfile: Check dump file early
Date: Mon, 22 Apr 2013 09:01:23 +0900	[thread overview]
Message-ID: <51747DD3.8000104@jp.fujitsu.com> (raw)
In-Reply-To: <20130419173644.4c24dead@holzheu>

(2013/04/20 0:36), Michael Holzheu wrote:
> On s390 the makedumpfile tool sometimes is used directly by
> users on the command line. Currently the check if the dump
> file already exists is done after the filtering function has
> been called. Therefore, for large dumps the user has to wait
> for filtering and after some time he gets the error message
> "open_dump_file: Can't open the dump file(out). File exists".
>
> This patch improves this by adding an early check for the
> existence of the dump file. In case the -f (force) option has
> been specified it is checked that an existing file is writable.
>
> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
> ---
>   makedumpfile.c |   37 ++++++++++++++++++++++++++++++++++++-
>   1 file changed, 36 insertions(+), 1 deletion(-)
>
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -730,6 +730,24 @@ open_dump_file(void)
>   }
>
>   int
> +check_dump_file(const char *path)
> +{
> +	char *err_str;
> +
> +	if (access(path, F_OK) != 0)
> +		return TRUE; /* File does not exist */
> +	if (info->flag_force) {
> +		if (access(path, W_OK) == 0)
> +			return TRUE; /* We have write permission */
> +		err_str = strerror(errno);
> +	} else {
> +		err_str = "File exists";

How about strerror(EEXIST)? It's better to avoid hard code to use the 
same string as what libc returns.

-- 
Thanks.
HATAYAMA, Daisuke


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2013-04-22  0:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 15:36 [PATCH] makedumpfile: Check dump file early Michael Holzheu
2013-04-22  0:01 ` HATAYAMA Daisuke [this message]
2013-04-22  9:11   ` Michael Holzheu
2013-04-24  1:33     ` Atsushi Kumagai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51747DD3.8000104@jp.fujitsu.com \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=holzheu@linux.vnet.ibm.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.