NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/56530: fstyp(8): Segmentation fault in the HAMMER2 filesystem check



The following reply was made to PR bin/56530; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/56530: fstyp(8): Segmentation fault in the HAMMER2 filesystem
 check
Date: Wed, 1 Dec 2021 19:27:23 +0000 (UTC)

 One more fix:
 
 # dkctl wd0 listwedges | fgrep dk1:
 dk1: Basic data partition, 1228800 blocks at 616448, type:
 
 Before:
 
 # fstyp -l /dev/dk1
 fstyp: ntfs: Could not open iconv: Invalid argument
 ntfs
 #
 
 After:
 
 # fstyp -l /dev/dk1
 ntfs Recovery
 #
 
 ---START---
 diff -urN usr.sbin/fstyp.orig/ntfs.c usr.sbin/fstyp/ntfs.c
 --- usr.sbin/fstyp.orig/ntfs.c	2019-12-28 08:22:30.000000000 +0000
 +++ usr.sbin/fstyp/ntfs.c	2021-12-01 19:12:46.956462159 +0000
 @@ -39,6 +39,7 @@
 
   #include <err.h>
   #include <iconv.h>
 +#include <langinfo.h>
   #include <stdint.h>
   #include <stdio.h>
   #include <stdlib.h>
 @@ -108,8 +109,7 @@
   	iconv_t cd;
   	size_t rc;
 
 -	/* dstname="" means convert to the current locale. */
 -	cd = iconv_open("", NTFS_ENC);
 +	cd = iconv_open(nl_langinfo(CODESET), NTFS_ENC);
   	if (cd == (iconv_t)-1) {
   		warn("ntfs: Could not open iconv");
   		return;
 ---END---
 
 Thanks,
 -RVP
 
 PS. In the previous patch, there's no need to `#include <sys/stat.h>'.
 Please remove it.
 


Home | Main Index | Thread Index | Old Index