Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: Pull up following revision(s) (requested by mlelstv in tick...
details: https://anonhg.NetBSD.org/src/rev/0365d7383fd8
branches: netbsd-8
changeset: 317939:0365d7383fd8
user: bouyer <bouyer%NetBSD.org@localhost>
date: Mon Apr 09 12:54:00 2018 +0000
description:
Pull up following revision(s) (requested by mlelstv in ticket #710):
sbin/gpt/main.c: revision 1.11
sbin/gpt/gpt.h: revision 1.37
sbin/gpt/set.c: revision 1.14
sbin/gpt/type.c: revision 1.14
sbin/gpt/unset.c: revision 1.14
sbin/gpt/gpt.8: revision 1.58
Check device parameter to avoid segfaults. Augment synopsis for -l option.
diffstat:
sbin/gpt/gpt.8 | 11 ++++++++++-
sbin/gpt/gpt.h | 1 +
sbin/gpt/main.c | 7 +++++--
sbin/gpt/set.c | 10 +++++-----
sbin/gpt/type.c | 10 +++++-----
sbin/gpt/unset.c | 11 ++++++-----
6 files changed, 32 insertions(+), 18 deletions(-)
diffs (201 lines):
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/gpt.8
--- a/sbin/gpt/gpt.8 Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/gpt.8 Mon Apr 09 12:54:00 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.52 2017/02/16 03:32:17 christos Exp $
+.\" $NetBSD: gpt.8,v 1.52.4.1 2018/04/09 12:54:00 bouyer Exp $
.\"
.\" Copyright (c) 2002 Marcel Moolenaar
.\" All rights reserved.
@@ -41,6 +41,15 @@
.Ar command
.Op Ar command_options
.Ar device
+.Nm
+.Ar set
+.Fl l
+.Nm
+.Ar unset
+.Fl l
+.Nm
+.Ar type
+.Fl l
.Sh DESCRIPTION
The
.Nm
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/gpt.h
--- a/sbin/gpt/gpt.h Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/gpt.h Mon Apr 09 12:54:00 2018 +0000
@@ -81,6 +81,7 @@
#define GPT_NOSYNC 0x08
#define GPT_FILE 0x10
#define GPT_TIMESTAMP 0x20
+#define GPT_OPTDEV 0x8000
void* gpt_read(gpt_t, off_t, size_t);
off_t gpt_last(gpt_t);
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/main.c
--- a/sbin/gpt/main.c Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/main.c Mon Apr 09 12:54:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $ */
+/* $NetBSD: main.c,v 1.10.4.1 2018/04/09 12:54:00 bouyer Exp $ */
/*-
* Copyright (c) 2002 Marcel Moolenaar
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.10.4.1 2018/04/09 12:54:00 bouyer Exp $");
#endif
#include <stdio.h>
@@ -241,6 +241,9 @@
if (gpt == NULL)
return EXIT_FAILURE;
} else {
+ if ((cmdsw[i]->flags & GPT_OPTDEV) == 0)
+ errx(EXIT_FAILURE,
+ "Command %s needs a device parameter", cmd);
argc++;
gpt = NULL;
}
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/set.c
--- a/sbin/gpt/set.c Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/set.c Mon Apr 09 12:54:00 2018 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: set.c,v 1.13 2015/12/29 16:45:04 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.13.8.1 2018/04/09 12:54:00 bouyer Exp $");
#endif
#include <sys/types.h>
@@ -60,7 +60,7 @@
"set",
cmd_set,
sethelp, __arraycount(sethelp),
- 0,
+ GPT_OPTDEV,
};
#define usage() gpt_usage(NULL, &c_set)
@@ -75,11 +75,11 @@
while ((ch = getopt(argc, argv, "a:i:l")) != -1) {
switch(ch) {
case 'a':
- if (gpt_attr_get(gpt, &attributes) == -1)
+ if (gpt == NULL || gpt_attr_get(gpt, &attributes) == -1)
return usage();
break;
case 'i':
- if (gpt_uint_get(gpt, &entry) == -1)
+ if (gpt == NULL || gpt_uint_get(gpt, &entry) == -1)
return usage();
break;
case 'l':
@@ -90,7 +90,7 @@
}
}
- if (argc != optind)
+ if (gpt == NULL || argc != optind)
return usage();
return gpt_attr_update(gpt, entry, attributes, 0);
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/type.c
--- a/sbin/gpt/type.c Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/type.c Mon Apr 09 12:54:00 2018 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: type.c,v 1.13 2015/12/06 00:39:26 christos Exp $");
+__RCSID("$NetBSD: type.c,v 1.13.8.1 2018/04/09 12:54:00 bouyer Exp $");
#endif
#include <sys/types.h>
@@ -61,7 +61,7 @@
"type",
cmd_type,
typehelp, __arraycount(typehelp),
- 0,
+ GPT_OPTDEV,
};
#define usage() gpt_usage(NULL, &c_type)
@@ -91,17 +91,17 @@
gpt_uuid_help("\t");
return 0;
case 'T':
- if (gpt_uuid_get(gpt, &newtype) == -1)
+ if (gpt == NULL || gpt_uuid_get(gpt, &newtype) == -1)
return -1;
break;
default:
- if (gpt_add_find(gpt, &find, ch) == -1)
+ if (gpt == NULL || gpt_add_find(gpt, &find, ch) == -1)
return usage();
break;
}
}
- if (gpt_uuid_is_nil(newtype) || argc != optind)
+ if (gpt == NULL || gpt_uuid_is_nil(newtype) || argc != optind)
return usage();
return gpt_change_ent(gpt, &find, change, &newtype);
diff -r cc350cde7a33 -r 0365d7383fd8 sbin/gpt/unset.c
--- a/sbin/gpt/unset.c Mon Apr 09 12:49:31 2018 +0000
+++ b/sbin/gpt/unset.c Mon Apr 09 12:54:00 2018 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: unset.c,v 1.13 2015/12/29 16:45:04 christos Exp $");
+__RCSID("$NetBSD: unset.c,v 1.13.8.1 2018/04/09 12:54:00 bouyer Exp $");
#endif
#include <sys/types.h>
@@ -53,13 +53,14 @@
static const char *unsethelp[] = {
"-a attribute -i index",
+ "-l",
};
struct gpt_cmd c_unset = {
"unset",
cmd_unset,
unsethelp, __arraycount(unsethelp),
- 0,
+ GPT_OPTDEV,
};
#define usage() gpt_usage(NULL, &c_unset)
@@ -74,11 +75,11 @@
while ((ch = getopt(argc, argv, "a:i:l")) != -1) {
switch(ch) {
case 'a':
- if (gpt_attr_get(gpt, &attributes) == -1)
+ if (gpt == NULL || gpt_attr_get(gpt, &attributes) == -1)
return usage();
break;
case 'i':
- if (gpt_uint_get(gpt, &entry) == -1)
+ if (gpt == NULL || gpt_uint_get(gpt, &entry) == -1)
return usage();
break;
case 'l':
@@ -89,7 +90,7 @@
}
}
- if (argc != optind)
+ if (gpt == NULL || argc != optind)
return usage();
return gpt_attr_update(gpt, entry, 0, attributes);
Home |
Main Index |
Thread Index |
Old Index