--- src/sbin/jscan/jscan.c 2005/11/06 12:32:56 1.10 +++ src/sbin/jscan/jscan.c 2007/01/26 18:58:55 1.11 @@ -188,6 +188,18 @@ main(int ac, char **av) "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 @@ main(int ac, char **av) } } + 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