summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2015-12-22 17:22:17 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2015-12-23 00:49:03 +0100
commit3f422795dba42d5cdcaa2d1a684bdc8c71835dd7 (patch)
tree3f0d7ad264b5e2a00339f88aad7801b2a0dbc88a
parent8bc67dc065f7bb74824bff0d7c582bc400b30c57 (diff)
downloadlibusbg-3f422795dba42d5cdcaa2d1a684bdc8c71835dd7.tar.gz
libusbg-3f422795dba42d5cdcaa2d1a684bdc8c71835dd7.tar.bz2
libusbg-3f422795dba42d5cdcaa2d1a684bdc8c71835dd7.zip
libusbgx: Use rmdir() instead of unlink() for directories
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
-rw-r--r--src/function/ms.c4
-rw-r--r--src/usbg.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/function/ms.c b/src/function/ms.c
index 9ec1828..352113b 100644
--- a/src/function/ms.c
+++ b/src/function/ms.c
@@ -545,7 +545,7 @@ int usbg_f_ms_create_lun(usbg_f_ms *mf, int lun_id,
return 0;
remove_lun:
- unlink(lpath);
+ rmdir(lpath);
return ret;
}
@@ -567,7 +567,7 @@ int usbg_f_ms_rm_lun(usbg_f_ms *mf, int lun_id)
if (ret >= sizeof(lpath))
return USBG_ERROR_PATH_TOO_LONG;
- ret = unlink(lpath);
+ ret = rmdir(lpath);
if (ret)
return usbg_translate_error(errno);
diff --git a/src/usbg.c b/src/usbg.c
index d99e8e2..92fe441 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -1313,7 +1313,7 @@ static int usbg_create_empty_gadget(usbg_state *s, const char *name,
return 0;
rm_gdir:
- unlink(gpath);
+ rmdir(gpath);
free_gadget:
usbg_free_gadget(*g);
*g = NULL;
@@ -1905,7 +1905,7 @@ int usbg_create_config(usbg_gadget *g, int id, const char *label,
return 0;
rm_config:
- unlink(cpath);
+ rmdir(cpath);
free_config:
usbg_free_config(conf);
out: