[PATCH 2/2] nilfs-tune: catch and handle missing device argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before:
    $ nilfs-tune -l
    nilfs-tune 2.1.0
    cannot open device -l: No such file or directory

After:
    $ ./sbin/nilfs-tune/nilfs-tune -l
    nilfs-tune 2.1.0
    Usage: nilfs-tune [-h] [-l] [-i interval] [-L volume_name]
                      [-m block_max] [-O [^]feature[,...]]
                      [-U UUID] device

Signed-off-by: Dan McGee <dan@xxxxxxxxxxxxx>
---
 sbin/nilfs-tune/nilfs-tune.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/sbin/nilfs-tune/nilfs-tune.c b/sbin/nilfs-tune/nilfs-tune.c
index cd5ef24..6655029 100644
--- a/sbin/nilfs-tune/nilfs-tune.c
+++ b/sbin/nilfs-tune/nilfs-tune.c
@@ -187,6 +187,12 @@ static void parse_options(int argc, char *argv[],
 			exit(EXIT_FAILURE);
 		}
 	}
+
+	if (optind == argc)
+	{
+		nilfs_tune_usage();
+		exit(EXIT_FAILURE);
+	}
 }
 
 #define MINUTE	(60)
-- 
1.7.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux