From: Jan Kiszka Date: Wed, 24 Jun 2009 12:42:31 +0000 (+0200) Subject: slirp: Use shell to erase smb directory X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~8659 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=832fdc5d124d54d0fd7bf286c8f056d2f68ae01e;p=sdk%2Femulator%2Fqemu.git slirp: Use shell to erase smb directory Instead of open-coding this, we can use the power of the shell to remove the smb_dir on exit. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- diff --git a/net.c b/net.c index f180b33c71..bfc63178bb 100644 --- a/net.c +++ b/net.c @@ -1014,35 +1014,13 @@ void net_slirp_redir(const char *redir_str) static char smb_dir[1024]; -static void erase_dir(char *dir_name) -{ - DIR *d; - struct dirent *de; - char filename[1024]; - - /* erase all the files in the directory */ - if ((d = opendir(dir_name)) != NULL) { - for(;;) { - de = readdir(d); - if (!de) - break; - if (strcmp(de->d_name, ".") != 0 && - strcmp(de->d_name, "..") != 0) { - snprintf(filename, sizeof(filename), "%s/%s", - smb_dir, de->d_name); - if (unlink(filename) != 0) /* is it a directory? */ - erase_dir(filename); - } - } - closedir(d); - rmdir(dir_name); - } -} - /* automatic user mode samba server configuration */ static void smb_exit(void) { - erase_dir(smb_dir); + char cmd[1024]; + + snprintf(cmd, sizeof(cmd), "rm -rf %s", smb_dir); + system(cmd); } static void slirp_smb(SlirpState* s, const char *exported_dir,