- r = command (&out, &err, "strings", "-e", encoding, buf, NULL);
- free (buf);
+ CHROOT_IN;
+ fd = open (path, O_RDONLY);
+ CHROOT_OUT;
+
+ if (fd == -1) {
+ reply_with_perror ("%s", path);
+ return NULL;
+ }
+
+ flags = COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN | fd;
+ r = commandf (&out, &err, flags, "strings", "-e", encoding, NULL);