Greg,

I committed that patch.

amanda should print:
  error opening device 'tape:/dev/nst0': Device type "tape" is not known

Jean-Louis

On 03/24/2015 10:37 AM, Greg Troxel wrote:
Thanks very much for the hint.

It would be nice if instead of that error message one got "you tried to
use a tape: device but amanda is configured without tape drive support".

The problem is that the tests for the tape drive don't include the
required prereqs; I realize the rules for this differ.  The following
isn't really the right fix, but make this compile and pass amcheck.  I
have not checked that it is all necessary.  If sys/time.h is more or
less universal (sys/types.h is already unconditionally included in some
tests), then it might be totally ok to just add them.



diff --git a/config/amanda/tape.m4 b/config/amanda/tape.m4
index 7636c2e..76e5ef8 100644
--- a/config/amanda/tape.m4
+++ b/config/amanda/tape.m4
@@ -34,6 +34,10 @@ AC_DEFUN([AMANDA_TAPE_DEVICE], [
     # check for MTIOCTOP, an indicator of POSIX tape support
     AC_CACHE_CHECK([for MTIOCTOP], amanda_cv_HAVE_MTIOCTOP,[
 	AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
 #ifdef HAVE_SYS_TAPE_H
 # include <sys/tape.h>
 #endif
@@ -66,6 +70,9 @@ AC_DEFUN([AMANDA_TAPE_DEVICE], [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
 #include <sys/mtio.h>
 	]], [[
 	    struct mtget buf;
@@ -85,6 +92,9 @@ AC_DEFUN([AMANDA_TAPE_DEVICE], [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
 #include <sys/mtio.h>
 	]], [[
 	    struct mtget buf;
@@ -139,6 +149,9 @@ AC_DEFUN([AMANDA_TAPE_DEVICE], [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
 #include <sys/mtio.h>
 	]], [[
 	    struct mtget buf;
diff --git a/device-src/device.c b/device-src/device.c
index 76091bd..d6363ba 100644
--- a/device-src/device.c
+++ b/device-src/device.c
@@ -431,17 +431,13 @@ handle_device_regex(const char * user_name, char ** driver_name,
         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]);

Reply via email to