- if (stat(filesys, &stbuf) < 0) {
- fprintf(stderr, "cannot stat directory %s: %s\n",
- filesys, strerror(errno));
- exit(1);
- } else {
- if (chdir(filesys) < 0) {
- fprintf(stderr, "cannot cd to %s: %s\n",
- filesys, strerror(errno));
- exit(1);
- }
- }
+ if (stat(filesys, &stbuf) < 0)
+ err(1, "cannot stat directory %s", filesys);
+ if (chdir(filesys) < 0)
+ err(1, "cannot cd to %s", filesys);