Lines Matching refs:dir
30 char dir[512] = { '\0' };
43 strscpy(dir, home);
46 strlcat(dir, uml_dir, sizeof(dir));
47 len = strlen(dir);
48 if (len > 0 && dir[len - 1] != '/')
49 strlcat(dir, "/", sizeof(dir));
52 uml_dir = malloc(strlen(dir) + 1);
58 strcpy(uml_dir, dir);
76 * Unlinks the files contained in @dir and then removes @dir.
81 static int remove_files_and_dir(char *dir)
89 directory = opendir(dir);
100 len = strlen(dir) + strlen("/") + strlen(ent->d_name) + 1;
106 sprintf(file, "%s/%s", dir, ent->d_name);
113 if (rmdir(dir) < 0 && errno != ENOENT) {
136 static inline int is_umdir_used(char *dir)
140 size_t filelen = strlen(dir) + sizeof("/pid") + 1;
146 snprintf(file, filelen, "%s/pid", dir);
191 * Try to remove the directory @dir unless it's in use.
192 * Precondition: @dir exists.
196 static int umdir_take_if_dead(char *dir)
199 if (is_umdir_used(dir))
202 ret = remove_files_and_dir(dir);
393 char *dir, err;
395 dir = malloc(strlen(uml_dir) + UMID_LEN + 1);
396 if (!dir)
399 sprintf(dir, "%s%s", uml_dir, umid);
400 err = remove_files_and_dir(dir);
405 free(dir);