[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 36/41] slirp: Use shell to erase smb directory
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 36/41] slirp: Use shell to erase smb directory |
Date: |
Wed, 24 Jun 2009 14:42:31 +0200 |
User-agent: |
StGIT/0.14.3 |
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 <address@hidden>
---
net.c | 30 ++++--------------------------
1 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/net.c b/net.c
index 0c1a99b..edf7ca6 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,
- [Qemu-devel] [PATCH 20/41] slirp: tftp: Cleanup tftp_prefix check, (continued)
- [Qemu-devel] [PATCH 20/41] slirp: tftp: Cleanup tftp_prefix check, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 21/41] slirp: tftp: Clean up tftp_send_error, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 29/41] slirp: Clean up timeout handling around slirp_select_fill/poll, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 26/41] slirp: Clean up updtime, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 25/41] slirp: Make IP packet ID consistent, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 27/41] slirp: Kill slirp_is_inited, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 28/41] slirp: Drop redundant checks from slirp_output, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 36/41] slirp: Use shell to erase smb directory,
Jan Kiszka <=
- [Qemu-devel] [PATCH 35/41] slirp: Save/restore bootp client states, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 32/41] slirp: Use internal state in interface, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 33/41] slirp: Allocate/free stack instance dynamically, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 31/41] slirp: Factor out internal state structure, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 34/41] slirp: Enable multiple instances, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 41/41] slirp: Basic VLAN client info_str, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 39/41] net: Provide VLAN client lookup helper, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 40/41] slirp: Make hostfwd_add/remove multi-instance-aware, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 37/41] slirp: Improve error handling in slirp_smb, Jan Kiszka, 2009/06/24
- [Qemu-devel] [PATCH 38/41] slirp: Enable multi-instance support for the smb service, Jan Kiszka, 2009/06/24