Index: jscan.c =================================================================== RCS file: /home/dcvs/src/sbin/jscan/jscan.c,v retrieving revision 1.10 diff -u -r1.10 jscan.c --- jscan.c 6 Nov 2005 12:32:56 -0000 1.10 +++ jscan.c 26 Jan 2007 09:43:07 -0000 @@ -188,6 +188,18 @@ "or zero if stdin is to be the input.\n"); usage(av[0]); } + if (strcmp(mirror_directory, ".") != 0) { + struct stat sb; + if (stat(mirror_directory, &sb) != 0) { + perror ("Could not stat mirror directory"); + usage(av[0]); + } + if (!S_ISDIR(sb.st_mode)) + { + fprintf (stderr, "Mirror directory '%s' is not a directory\n", mirror_directory); + usage(av[0]); + } + } if (jdirection == JD_BACKWARDS && (jmodes & (JMODEF_RECORD|JMODEF_OUTPUT))) { fprintf(stderr, "Undo mode is only good in mirroring mode and " "cannot be mixed with other modes.\n"); @@ -270,6 +282,13 @@ } } + if (strcmp(mirror_directory, ".") != 0) { + if (chdir (mirror_directory) != 0) { + perror ("Could not enter mirror directory"); + exit (1); + } + } + /* * Now it gets more difficult. If we are recording then the input * could be representative of continuing data and not have any