}
         }
 
-         Dmsg1(30, "Outfile=%s\n", ofile);
+        jcr->num_files_examined++;
 
+         Dmsg1(30, "Outfile=%s\n", ofile);
         extract = FALSE;
         stat = create_file(jcr, fname, ofile, lname, type, 
                            stream, &statp, attribsEx, &bfd, jcr->replace, 
            break;
         }  
 
-        jcr->num_files_examined++;
 
       /* Data stream */
       } else if (stream == STREAM_FILE_DATA || stream == STREAM_SPARSE_DATA) {
  */
 static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp)
 {
-   char buf[2000]; 
+   char buf[5000]; 
    char ec1[30];
    char *p, *f;
    int n;
    }
    *p++ = '\n';
    *p = 0;
-   Dmsg0(20, buf);
+   Dmsg1(20, "%s", buf);
    Jmsg(jcr, M_RESTORED, 0, "%s", buf);
 }
 
             * execute bit set (i.e. parent_mode), and preserve what already
             * exists. Normally, this should do nothing.
             */
-           stat = !make_path(jcr, ofile, parent_mode, parent_mode, uid, gid, 1, NULL);
-           if (stat == 0) {
+           if (!make_path(jcr, ofile, parent_mode, parent_mode, uid, gid, 1, NULL)) {
                Dmsg1(0, "Could not make path. %s\n", ofile);
-               Jmsg1(jcr, M_ERROR, 0, _("Could not make path. %s\n"), ofile);
               return CF_ERROR;
            }
         }
         }
          Dmsg1(50, "Create file: %s\n", ofile);
         if ((bopen(ofd, ofile, mode, S_IRUSR | S_IWUSR)) < 0) {
-            Jmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"), ofile, berror(ofd));
+            Jmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"), 
+                 ofile, berror(ofd));
            return CF_ERROR;
         }
         return CF_EXTRACT;
         if (S_ISFIFO(statp->st_mode)) {
             Dmsg1(200, "Restore fifo: %s\n", ofile);
            if (mkfifo(ofile, statp->st_mode) != 0 && errno != EEXIST) {
-               Jmsg2(jcr, M_ERROR, 0, _("Cannot make fifo %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Cannot make fifo %s: ERR=%s\n"), 
+                    ofile, strerror(errno));
               return CF_ERROR;
            }
         } else {          
             Dmsg1(200, "Restore node: %s\n", ofile);
            if (mknod(ofile, statp->st_mode, statp->st_rdev) != 0 && errno != EEXIST) {
-               Jmsg2(jcr, M_ERROR, 0, _("Cannot make node %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Cannot make node %s: ERR=%s\n"), 
+                    ofile, strerror(errno));
               return CF_ERROR;
            }
         }       
               tid = NULL;
            }
            if ((bopen(ofd, ofile, mode, 0)) < 0) {
-               Jmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"), ofile, berror(ofd));
+               Jmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"), 
+                    ofile, berror(ofd));
               stop_thread_timer(tid);
               return CF_ERROR;
            }
          Dmsg2(130, "FT_LNK should restore: %s -> %s\n", ofile, lname);
         if (symlink(lname, ofile) != 0 && errno != EEXIST) {
             Jmsg3(jcr, M_ERROR, 0, _("Could not symlink %s -> %s: ERR=%s\n"),
-                 ofile, lname, berror(ofd));
+                 ofile, lname, strerror(errno));
            return CF_ERROR;
         }
         return CF_CREATED;
       case FT_LNKSAVED:                 /* Hard linked, file already saved */
       Dmsg2(130, "Hard link %s => %s\n", ofile, lname);
       if (link(lname, ofile) != 0) {
-         Jmsg3(jcr, M_ERROR, 0, _("Could not hard link %s ==> %s: ERR=%s\n"),
-              ofile, lname, berror(ofd));
+         Jmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s: ERR=%s\n"),
+              ofile, lname, strerror(errno));
         return CF_ERROR;
       }
       return CF_CREATED;
 
    case FT_DIR:
       Dmsg2(300, "Make dir mode=%o dir=%s\n", new_mode, ofile);
-      if (make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL) != 0) {
-         Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s\n"), 
-              ofile, berror(ofd));
+      if (!make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL)) {
         return CF_ERROR;
       }
       return CF_CREATED;
 
 
        case 0:                           /* child */
          /* look for shell */
-          if ((shellcmd = getenv("SHELL")) == NULL)
+          if ((shellcmd = getenv("SHELL")) == NULL) {
              shellcmd = "/bin/sh";
+         }
          close(1); dup(pfd[1]);          /* attach pipes to stdin and stdout */
          close(2); dup(pfd[1]);
          for (i = 3; i < 32; i++)        /* close everything else */
             close(i);
           strcpy(echout, "echo ");        /* form echo command */
-         strcat(echout, name);
+         bstrncat(echout, name, sizeof(echout));
           execl(shellcmd, shellcmd, "-c", echout, NULL); /* give to shell */
           exit(127);                      /* shouldn't get here */
 
        default:                          /* parent */
          /* read output from child */
+         echout[0] = 0;
          i = read(pfd[0], echout, sizeof echout);
-         echout[--i] = 0;                /* set end of string */
-         /* look for first word or first line. */
-         while (--i >= 0) {
-             if (echout[i] == ' ' || echout[i] == '\n')
-               echout[i] = 0;            /* keep only first one */
+         if (i > 0) {
+            echout[--i] = 0;                /* set end of string */
+            /* look for first line. */
+            while (--i >= 0) {
+                if (echout[i] == '\n') {
+                  echout[i] = 0;            /* keep only first one */
+               }
+            }
          }
-         istat = signal(SIGINT, SIG_IGN);
-         qstat = signal(SIGQUIT, SIG_IGN);
          /* wait for child to exit */
          while ((wpid = wait(&waitstatus)) != pid && wpid != -1)
             { ; }
-         signal(SIGINT, istat);
-         signal(SIGQUIT, qstat);
          strcpy(name, echout);
          stat = 1;
          break;