| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: gpt.c,v 1.25 2021/07/17 18:07:22 martin Exp $ */ | | 1 | /* $NetBSD: gpt.c,v 1.26 2021/07/17 19:27:22 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright 2018 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -1370,27 +1370,27 @@ gpt_sanitize(int diskfd, const struct gp | | | @@ -1370,27 +1370,27 @@ gpt_sanitize(int diskfd, const struct gp |
1370 | for (struct gpt_part_entry *pe = parts->partitions; | | 1370 | for (struct gpt_part_entry *pe = parts->partitions; |
1371 | pe != NULL; pe = pe->gp_next) { | | 1371 | pe != NULL; pe = pe->gp_next) { |
1372 | if (pe == ignore) | | 1372 | if (pe == ignore) |
1373 | continue; | | 1373 | continue; |
1374 | if ((pe->gp_flags & GPEF_WEDGE) && | | 1374 | if ((pe->gp_flags & GPEF_WEDGE) && |
1375 | strcmp(pe->gp_dev_name, devname) == 0) { | | 1375 | strcmp(pe->gp_dev_name, devname) == 0) { |
1376 | found = true; | | 1376 | found = true; |
1377 | break; | | 1377 | break; |
1378 | } | | 1378 | } |
1379 | } | | 1379 | } |
1380 | if (found) | | 1380 | if (found) |
1381 | continue; | | 1381 | continue; |
1382 | memset(&delw, 0, sizeof(delw)); | | 1382 | memset(&delw, 0, sizeof(delw)); |
1383 | strncpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname)); | | 1383 | strlcpy(delw.dkw_devname, devname, sizeof(delw.dkw_devname)); |
1384 | (void)ioctl(diskfd, DIOCDWEDGE, &delw); | | 1384 | (void)ioctl(diskfd, DIOCDWEDGE, &delw); |
1385 | } | | 1385 | } |
1386 | | | 1386 | |
1387 | /* cleanup */ | | 1387 | /* cleanup */ |
1388 | free(dkw); | | 1388 | free(dkw); |
1389 | } | | 1389 | } |
1390 | | | 1390 | |
1391 | static bool | | 1391 | static bool |
1392 | gpt_add_wedge(const char *disk, struct gpt_part_entry *p, | | 1392 | gpt_add_wedge(const char *disk, struct gpt_part_entry *p, |
1393 | const struct gpt_disk_partitions *parts) | | 1393 | const struct gpt_disk_partitions *parts) |
1394 | { | | 1394 | { |
1395 | struct dkwedge_info dkw; | | 1395 | struct dkwedge_info dkw; |
1396 | const char *tname; | | 1396 | const char *tname; |