FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-18-2012, 03:39 PM
Andrew Price
 
Default mkfs.gfs2: Improve error messages

Currently mkfs.gfs2 does not warn that the lock table has been omitted,
it just complains about a missing colon in the lock table. It also
prefixes error messages with the absolute path of the source file. This
patch removes the path from error messages (in mkfs and edit) and adds a
check for an empty lock table.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/hexedit.h | 1 -
gfs2/mkfs/gfs2_mkfs.h | 1 -
gfs2/mkfs/main_mkfs.c | 4 ++++
3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index b05b5c0..dd76810 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -129,7 +129,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
void die(const char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index d7d7da7..231f370 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -24,7 +24,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
void die(const char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 3658fd4..7c93621 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -257,6 +257,10 @@ static void test_locking(char *lockproto, char *locktable)
/* Nolock is always ok. */
} else if (strcmp(lockproto, "lock_gulm") == 0 ||
strcmp(lockproto, "lock_dlm") == 0) {
+ if (locktable == NULL || *locktable == '') {
+ fprintf(stderr, _("No lock table specified.
"));
+ exit(-1);
+ }
for (c = locktable; *c; c++) {
if (isspace(*c))
die( _("locktable error: contains space characters
"));
--
1.7.7.5
 
Old 01-18-2012, 03:48 PM
Steven Whitehouse
 
Default mkfs.gfs2: Improve error messages

Hi,

Those all look good to me. Thanks,

Steve.

On Wed, 2012-01-18 at 16:39 +0000, Andrew Price wrote:
> Currently mkfs.gfs2 does not warn that the lock table has been omitted,
> it just complains about a missing colon in the lock table. It also
> prefixes error messages with the absolute path of the source file. This
> patch removes the path from error messages (in mkfs and edit) and adds a
> check for an empty lock table.
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> gfs2/edit/hexedit.h | 1 -
> gfs2/mkfs/gfs2_mkfs.h | 1 -
> gfs2/mkfs/main_mkfs.c | 4 ++++
> 3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
> index b05b5c0..dd76810 100644
> --- a/gfs2/edit/hexedit.h
> +++ b/gfs2/edit/hexedit.h
> @@ -129,7 +129,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
> void die(const char *fmt, ...)
> {
> va_list ap;
> - fprintf(stderr, "%s: ", __FILE__);
> va_start(ap, fmt);
> vfprintf(stderr, fmt, ap);
> va_end(ap);
> diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
> index d7d7da7..231f370 100644
> --- a/gfs2/mkfs/gfs2_mkfs.h
> +++ b/gfs2/mkfs/gfs2_mkfs.h
> @@ -24,7 +24,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
> void die(const char *fmt, ...)
> {
> va_list ap;
> - fprintf(stderr, "%s: ", __FILE__);
> va_start(ap, fmt);
> vfprintf(stderr, fmt, ap);
> va_end(ap);
> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> index 3658fd4..7c93621 100644
> --- a/gfs2/mkfs/main_mkfs.c
> +++ b/gfs2/mkfs/main_mkfs.c
> @@ -257,6 +257,10 @@ static void test_locking(char *lockproto, char *locktable)
> /* Nolock is always ok. */
> } else if (strcmp(lockproto, "lock_gulm") == 0 ||
> strcmp(lockproto, "lock_dlm") == 0) {
> + if (locktable == NULL || *locktable == '') {
> + fprintf(stderr, _("No lock table specified.
"));
> + exit(-1);
> + }
> for (c = locktable; *c; c++) {
> if (isspace(*c))
> die( _("locktable error: contains space characters
"));
 

Thread Tools




All times are GMT. The time now is 12:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org