pkgsrc/sysutils/ntfsprogs/patches/patch-ad
agc f6726d0a8f Initial import of ntfsprogs-1.9.4 into the packages collection.
The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to
	bring full support for the NTFS filesystem to the Linux
	operating system.  The ntfsprogs package currently consists of
	a static library and utilities such as mkntfs, ntfscat,
	ntfsls, ntfsresize, and ntfsundelete (for a full list of
	included utilities see man 8 ntfsprogs after installation).

Provided in PR 27119 by Darrin B.  Jewell, modified by myself to
remove dylib files from PLIST, add NetBSD statvfs compatibility, and
quieten a warning in one of the patches.

Darrin's patches perform the following changes:
  . provide for redirection of error output without having an lvalue stderr
  . support for NetBSD disklabels
  . fix for ntfs_attr_pread to avoid reading a partial block
  . workaround for darwin sys/mount.h namespace pollution

This package is currently configured with the gnome-vfs module disabled.
2004-10-05 12:39:38 +00:00

97 lines
2.1 KiB
Text

$NetBSD: patch-ad,v 1.1.1.1 2004/10/05 12:39:38 agc Exp $
--- libntfs/debug.c.orig Sat Sep 4 06:16:32 2004
+++ libntfs/debug.c
@@ -25,18 +25,20 @@
#include "attrib.h"
#include "debug.h"
+FILE *ntfs_err_out = stderr;
+
/**
- * Sprintf - silencable output to stderr
- * @silent: if 0 string is output to stderr
+ * Sprintf - silencable output to ntfs_err_out
+ * @silent: if 0 string is output to ntfs_err_out
* @fmt: printf style format string
* @...: optional arguments for the printf style format string
*
- * If @silent is 0, output the string @fmt to stderr.
+ * If @silent is 0, output the string @fmt to ntfs_err_out.
*
* This is basically a replacement for:
*
* if (!silent)
- * fprintf(stderr, fmt, ...);
+ * fprintf(ntfs_err_out, fmt, ...);
*
* It is more convenient to use Sprintf instead of the above code and perhaps
* more importantly, Sprintf makes it much easier to turn it into a "do
@@ -48,41 +50,61 @@
int eo;
va_list ap;
- if (silent)
+ if (silent || !ntfs_err_out)
return;
eo = errno;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ vfprintf(ntfs_err_out, fmt, ap);
va_end(ap);
+ fflush(ntfs_err_out);
errno = eo;
}
#ifdef DEBUG
-/* Debug output to stderr. To get it run ./configure --enable-debug. */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* Debug output to ntfs_err_out. To get it run ./configure --enable-debug. */
void __Dprintf(const char *fmt, ...)
{
int eo = errno;
va_list ap;
+ if (!ntfs_err_out)
+ return;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ vfprintf(ntfs_err_out, fmt, ap);
va_end(ap);
+ fflush(ntfs_err_out);
errno = eo;
}
void __Dputs(const char *s)
{
int eo = errno;
- fprintf(stderr, "%s\n", s);
+
+ if (!ntfs_err_out)
+ return;
+ fprintf(ntfs_err_out, "%s\n", s);
+ fflush(ntfs_err_out);
errno = eo;
}
void __Dperror(const char *s)
{
int eo = errno;
- perror(s);
+
+ if (!ntfs_err_out)
+ return;
+ if (s && s[0]) {
+ fprintf(ntfs_err_out, "%s: %s\n", s, strerror(eo));
+ } else {
+ fprintf(ntfs_err_out, "%s\n", strerror(eo));
+ }
+ fflush(ntfs_err_out);
errno = eo;
}