fstyp(8): Fix WITHOUT_ICONV build
Reported by: olivier
This commit is contained in:
parent
107eff5176
commit
5ab1cb52b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356041
@ -13,6 +13,10 @@ MAN= fstyp.8
|
|||||||
|
|
||||||
WARNS?= 2
|
WARNS?= 2
|
||||||
|
|
||||||
|
.if ${MK_ICONV} == "yes"
|
||||||
|
CFLAGS+= -DWITH_ICONV
|
||||||
|
.endif
|
||||||
|
|
||||||
.include <bsd.endian.mk>
|
.include <bsd.endian.mk>
|
||||||
|
|
||||||
.if ${TARGET_ENDIANNESS} == 1234
|
.if ${TARGET_ENDIANNESS} == 1234
|
||||||
|
@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iconv.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -33,7 +33,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef WITH_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#endif
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -184,6 +186,7 @@ exfat_compute_boot_chksum(FILE *fp, unsigned region, unsigned bytespersec,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_ICONV
|
||||||
static void
|
static void
|
||||||
convert_label(const uint16_t *ucs2label /* LE */, unsigned ucs2len, char
|
convert_label(const uint16_t *ucs2label /* LE */, unsigned ucs2len, char
|
||||||
*label_out, size_t label_sz)
|
*label_out, size_t label_sz)
|
||||||
@ -316,6 +319,7 @@ exfat_find_label(FILE *fp, const struct exfat_vbr *ev, unsigned BPS,
|
|||||||
free(declust);
|
free(declust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* WITH_ICONV */
|
||||||
|
|
||||||
int
|
int
|
||||||
fstyp_exfat(FILE *fp, char *label, size_t size)
|
fstyp_exfat(FILE *fp, char *label, size_t size)
|
||||||
@ -356,8 +360,10 @@ fstyp_exfat(FILE *fp, char *label, size_t size)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_ICONV
|
||||||
if (show_label)
|
if (show_label)
|
||||||
exfat_find_label(fp, ev, bytespersec, label, size);
|
exfat_find_label(fp, ev, bytespersec, label, size);
|
||||||
|
#endif
|
||||||
|
|
||||||
done:
|
done:
|
||||||
free(cksect);
|
free(cksect);
|
||||||
|
@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <capsicum_helpers.h>
|
#include <capsicum_helpers.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef WITH_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#endif
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -199,6 +201,7 @@ main(int argc, char **argv)
|
|||||||
err(1, "setlocale");
|
err(1, "setlocale");
|
||||||
caph_cache_catpages();
|
caph_cache_catpages();
|
||||||
|
|
||||||
|
#ifdef WITH_ICONV
|
||||||
/* Cache iconv conversion data before entering capability mode. */
|
/* Cache iconv conversion data before entering capability mode. */
|
||||||
if (show_label) {
|
if (show_label) {
|
||||||
for (i = 0; i < nitems(fstypes); i++) {
|
for (i = 0; i < nitems(fstypes); i++) {
|
||||||
@ -214,6 +217,7 @@ main(int argc, char **argv)
|
|||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iconv.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#ifdef WITH_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -94,6 +96,7 @@ struct ntfs_bootfile {
|
|||||||
uint32_t bf_volsn;
|
uint32_t bf_volsn;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
#ifdef WITH_ICONV
|
||||||
static void
|
static void
|
||||||
convert_label(const void *label /* LE */, size_t labellen, char *label_out,
|
convert_label(const void *label /* LE */, size_t labellen, char *label_out,
|
||||||
size_t label_sz)
|
size_t label_sz)
|
||||||
@ -125,6 +128,7 @@ convert_label(const void *label /* LE */, size_t labellen, char *label_out,
|
|||||||
|
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
fstyp_ntfs(FILE *fp, char *label, size_t size)
|
fstyp_ntfs(FILE *fp, char *label, size_t size)
|
||||||
@ -142,6 +146,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size)
|
|||||||
bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512);
|
bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512);
|
||||||
if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0)
|
if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
#ifdef WITH_ICONV
|
||||||
if (!show_label)
|
if (!show_label)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|
||||||
@ -171,6 +176,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ok:
|
ok:
|
||||||
|
#endif /* WITH_ICONV */
|
||||||
free(bf);
|
free(bf);
|
||||||
free(filerecp);
|
free(filerecp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user