diff mbox series

[11/51] qga/commands-posix-ssh: Use g_mkdir_with_parents()

Message ID 20220824094029.1634519-12-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Aug. 24, 2022, 9:39 a.m. UTC
From: Bin Meng <bin.meng@windriver.com>

g_mkdir() is a deprecated API and newer codes should use
g_mkdir_with_parents().

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 qga/commands-posix-ssh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Konstantin Kostiuk Aug. 24, 2022, 2:41 p.m. UTC | #1
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Wed, Aug 24, 2022 at 12:42 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Bin Meng <bin.meng@windriver.com>
>
> g_mkdir() is a deprecated API and newer codes should use
> g_mkdir_with_parents().
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  qga/commands-posix-ssh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
> index f3a580b8cc..2460112a38 100644
> --- a/qga/commands-posix-ssh.c
> +++ b/qga/commands-posix-ssh.c
> @@ -59,7 +59,7 @@ static bool
>  mkdir_for_user(const char *path, const struct passwd *p,
>                 mode_t mode, Error **errp)
>  {
> -    if (g_mkdir(path, mode) == -1) {
> +    if (g_mkdir_with_parents(path, mode) == -1) {
>          error_setg(errp, "failed to create directory '%s': %s",
>                     path, g_strerror(errno));
>          return false;
> --
> 2.34.1
>
>
Bin Meng Aug. 26, 2022, 2:46 p.m. UTC | #2
On Wed, Aug 24, 2022 at 10:41 PM Konstantin Kostiuk <kkostiuk@redhat.com> wrote:
>
> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>
> On Wed, Aug 24, 2022 at 12:42 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> From: Bin Meng <bin.meng@windriver.com>
>>
>> g_mkdir() is a deprecated API and newer codes should use
>> g_mkdir_with_parents().
>>
>> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>> ---
>>
>>  qga/commands-posix-ssh.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>

I was wrong that g_mkdir() is deprecated. I must have been misled by
the GTK glib doc.

Using g_mkdir() is still fine so this patch can be dropped. Sorry about that.

Regards,
Bin
diff mbox series

Patch

diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
index f3a580b8cc..2460112a38 100644
--- a/qga/commands-posix-ssh.c
+++ b/qga/commands-posix-ssh.c
@@ -59,7 +59,7 @@  static bool
 mkdir_for_user(const char *path, const struct passwd *p,
                mode_t mode, Error **errp)
 {
-    if (g_mkdir(path, mode) == -1) {
+    if (g_mkdir_with_parents(path, mode) == -1) {
         error_setg(errp, "failed to create directory '%s': %s",
                    path, g_strerror(errno));
         return false;