Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/partedit/partedit.c
Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | /* Sort filesystems for fstab so that mountpoints are ordered */ | ||||
/* Now re-add everything */ | /* Now re-add everything */ | ||||
while (nparts-- > 0) | while (nparts-- > 0) | ||||
TAILQ_INSERT_HEAD(&part_metadata, | TAILQ_INSERT_HEAD(&part_metadata, | ||||
tobesorted[nparts], metadata); | tobesorted[nparts], metadata); | ||||
free(tobesorted); | free(tobesorted); | ||||
} | } | ||||
if (getenv("PATH_FSTAB") != NULL) | |||||
fstab_path = getenv("PATH_FSTAB"); | fstab_path = getenv("PATH_FSTAB"); | ||||
else | if (fstab_path == NULL) | ||||
fstab_path = "/etc/fstab"; | fstab_path = "/etc/fstab"; | ||||
fstab = fopen(fstab_path, "w+"); | fstab = fopen(fstab_path, "w+"); | ||||
if (fstab == NULL) { | if (fstab == NULL) { | ||||
sprintf(message, "Cannot open fstab file %s for writing (%s)\n", | error = snprintf(message, sizeof(message), "Cannot open fstab file %s" | ||||
getenv("PATH_FSTAB"), strerror(errno)); | " for writing (%s)\n", fstab_path, strerror(errno)); | ||||
if (error < 0) { | |||||
snprintf(message, sizeof(message), "Cannot open fstab file for" | |||||
" writing (%s)\n", strerror(errno)); | |||||
} | |||||
conf.title = "Error"; | conf.title = "Error"; | ||||
bsddialog_msgbox(&conf, message, 0, 0); | bsddialog_msgbox(&conf, message, 0, 0); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
fprintf(fstab, "# Device\tMountpoint\tFStype\tOptions\tDump\tPass#\n"); | fprintf(fstab, "# Device\tMountpoint\tFStype\tOptions\tDump\tPass#\n"); | ||||
TAILQ_FOREACH(md, &part_metadata, metadata) { | TAILQ_FOREACH(md, &part_metadata, metadata) { | ||||
if (md->fstab != NULL) | if (md->fstab != NULL) | ||||
fprintf(fstab, "%s\t%s\t\t%s\t%s\t%d\t%d\n", | fprintf(fstab, "%s\t%s\t\t%s\t%s\t%d\t%d\n", | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |