pkgsrc/sysutils/amanda-common/patches/patch-device-src_device.c
gdt 19e5716e30 Add 2 fixes to for amanda-server to work on NetBSD.
While amanda-client 3.3 has been stable on NetBSD for a while, the
server code has apparently never worked.  This commit adds several
patches:

  - include sys/{types,time}.h so autoconf tape drive checks pass
  - improve error messages when tape drive code is not compiled in
  - avoid perl crash in report generation

These changes have been tested on NetBSD 6 kernel with NetBSD 5
userland, amd64 (for no good reason, but this was the machine with the
tape drive), dumping many machines and writing to LTO.

The first two patches are taken from an upstream patch committed to
the 3.3 branch due to this problem being reported.  The third patch is
ad hoc based on perl debugging, and needs further investigation.  (But
it's better to get a report without a header line than an empty mail
message.)
2015-03-27 23:45:29 +00:00

27 lines
1 KiB
C

$NetBSD: patch-device-src_device.c,v 1.1 2015/03/27 23:45:29 gdt Exp $
This patch is from upstream, to improve error reporting when amanda is
configured without tape drive support and one tries to use a tape.
--- device-src/device.c.orig 2012-02-21 11:36:44.000000000 +0000
+++ device-src/device.c
@@ -423,17 +423,13 @@ handle_device_regex(const char * user_na
regfree(&regex);
return FALSE;
} else if (reg_result == REG_NOMATCH) {
+ *driver_name = stralloc("tape");
+ *device = stralloc(user_name);
#ifdef WANT_TAPE_DEVICE
g_warning(
"\"%s\" uses deprecated device naming convention; \n"
"using \"tape:%s\" instead.\n",
user_name, user_name);
- *driver_name = stralloc("tape");
- *device = stralloc(user_name);
-#else /* !WANT_TAPE_DEVICE */
- *errmsg = newvstrallocf(*errmsg, "\"%s\" is not a valid device name.\n", user_name);
- regfree(&regex);
- return FALSE;
#endif /* WANT_TAPE_DEVICE */
} else {
*driver_name = find_regex_substring(user_name, pmatch[1]);