| Index: gpt.c
|
| diff --git a/gpt.c b/gpt.c
|
| index a09df130c579e2010d99014ccfde961ef7097ff8..c1bf9445c2388cf775a09d414ecd4e5c224a1029 100644
|
| --- a/gpt.c
|
| +++ b/gpt.c
|
| @@ -60,7 +60,7 @@ off_t mediasz;
|
| u_int parts;
|
| u_int secsz;
|
|
|
| -int readonly, verbose;
|
| +int readonly, exclusive = O_EXCL, verbose;
|
|
|
| static uint32_t crc32_tab[] = {
|
| 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
| @@ -557,7 +557,7 @@ gpt_open(const char *dev)
|
| struct stat sb;
|
| int fd, mode;
|
|
|
| - mode = readonly ? O_RDONLY : O_RDWR|O_EXCL;
|
| + mode = readonly ? O_RDONLY : O_RDWR|exclusive;
|
|
|
| strlcpy(device_path, dev, sizeof(device_path));
|
| device_name = device_path;
|
| @@ -666,7 +666,7 @@ usage(void)
|
| {
|
|
|
| fprintf(stderr,
|
| - "usage: %s [-rv] [-p nparts] command [options] device ...\n",
|
| + "usage: %s [-rSv] [-p nparts] command [options] device ...\n",
|
| getprogname());
|
| exit(1);
|
| }
|
| @@ -694,7 +694,7 @@ main(int argc, char *argv[])
|
| int ch, i;
|
|
|
| /* Get the generic options */
|
| - while ((ch = getopt(argc, argv, "+p:rv")) != -1) {
|
| + while ((ch = getopt(argc, argv, "+p:rSv")) != -1) {
|
| switch(ch) {
|
| case 'p':
|
| if (parts > 0)
|
| @@ -706,6 +706,9 @@ main(int argc, char *argv[])
|
| case 'r':
|
| readonly = 1;
|
| break;
|
| + case 'S':
|
| + exclusive = 0;
|
| + break;
|
| case 'v':
|
| verbose++;
|
| break;
|
|
|