Pull up following revision(s) (requested by martin in ticket #732):
usr.sbin/sysinst/savenewlabel.c: revision 1.3 As pointed out by John D. Baker: replace all / characters in packnames (which might be automatically generated from controller names like "PERC 5/i") with a space before using the string as a file name.
This commit is contained in:
parent
c9ec079bc2
commit
489f707dcc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: savenewlabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
|
||||
/* $NetBSD: savenewlabel.c,v 1.2.4.1 2015/05/04 20:22:27 riz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Jonathan Stone
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: savenewlabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $");
|
||||
__RCSID("$NetBSD: savenewlabel.c,v 1.2.4.1 2015/05/04 20:22:27 riz Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -59,6 +59,7 @@ savenewlabel(partinfo *lp, int nparts)
|
|||
{
|
||||
FILE *f;
|
||||
char *f_name = malloc(STRSIZE * sizeof(char));
|
||||
char *sane_packname, *p;
|
||||
int i;
|
||||
pm_devs_t *pm_i;
|
||||
|
||||
|
@ -73,7 +74,12 @@ savenewlabel(partinfo *lp, int nparts)
|
|||
snprintf(pm_i->bsddiskname, DISKNAME_SIZE, "disk %c", i);
|
||||
}
|
||||
|
||||
snprintf(f_name, STRSIZE, "/tmp/disktab.%s", pm->bsddiskname);
|
||||
sane_packname = strdup(pm->bsddiskname);
|
||||
for (p = sane_packname; *p; p++)
|
||||
if (*p == '/')
|
||||
*p = ' ';
|
||||
snprintf(f_name, STRSIZE, "/tmp/disktab.%s", sane_packname);
|
||||
free(sane_packname);
|
||||
|
||||
/*
|
||||
N.B. disklabels only support up to 2TB (32-bit field for sectors).
|
||||
|
|
Loading…
Reference in New Issue