mirror of
https://github.com/sheumann/hush.git
synced 2024-08-01 01:28:57 +00:00
Fix a vfork bug, by Nick Fedchik and Vladimir N. Oleynik
This commit is contained in:
parent
82701e4d67
commit
157fea5960
@ -50,6 +50,7 @@ extern int run_parts(char **args, const unsigned char test_mode)
|
|||||||
struct dirent **namelist = 0;
|
struct dirent **namelist = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
char *arg0 = args[0];
|
||||||
int entries;
|
int entries;
|
||||||
int i;
|
int i;
|
||||||
int exitstatus = 0;
|
int exitstatus = 0;
|
||||||
@ -60,15 +61,15 @@ extern int run_parts(char **args, const unsigned char test_mode)
|
|||||||
(void) &exitstatus;
|
(void) &exitstatus;
|
||||||
#endif
|
#endif
|
||||||
/* scandir() isn't POSIX, but it makes things easy. */
|
/* scandir() isn't POSIX, but it makes things easy. */
|
||||||
entries = scandir(args[0], &namelist, valid_name, alphasort);
|
entries = scandir(arg0, &namelist, valid_name, alphasort);
|
||||||
|
|
||||||
if (entries == -1) {
|
if (entries == -1) {
|
||||||
perror_msg_and_die("failed to open directory %s", args[0]);
|
perror_msg_and_die("failed to open directory %s", arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < entries; i++) {
|
for (i = 0; i < entries; i++) {
|
||||||
|
|
||||||
filename = concat_path_file(args[0], namelist[i]->d_name);
|
filename = concat_path_file(arg0, namelist[i]->d_name);
|
||||||
|
|
||||||
if (stat(filename, &st) < 0) {
|
if (stat(filename, &st) < 0) {
|
||||||
perror_msg_and_die("failed to stat component %s", filename);
|
perror_msg_and_die("failed to stat component %s", filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user