[PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute()

Martin Kletzander mkletzan at redhat.com
Mon Apr 12 10:27:31 UTC 2021


On Tue, Mar 30, 2021 at 10:58:36PM +0800, Luke Yue wrote:
>The g_path_is_absolute() considers more situations
>than just a simply "path[0] == '/'".
>
>Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12
>
>Signed-off-by: Luke Yue <lukedyue at gmail.com>
>---
>src/util/virfile.c | 2 +-
>1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks for the patch, but it is broken.  No need to worry, that's
one fo the reasons why we have this requirement.  This is not to waste
your and our time setting up e-mails later on when we're on a tight
schedule in the coding period.

I am not sure how you sent this mail, but the best way is how we
describe it Submitting Patches [0] linked to from our Contribution
Guidelines [1].  And that is using `git send-email`.  If you did send it
using that tool, then there is something else wrong which we need to fix
first.

[0] https://libvirt.org/submitting-patches.html
[1] https://libvirt.org/hacking.html

>diff --git a/src/util/virfile.c b/src/util/virfile.c
>index 93fac200cc..3311eaff3d 100644
>--- a/src/util/virfile.c
>+++ b/src/util/virfile.c
>@@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED,
>int
>virFileAbsPath(const char *path, char **abspath)
>{
>- if (path[0] == '/') {
>+ if (g_path_is_absolute(path)) {
>*abspath = g_strdup(path);
>} else {
>g_autofree char *buf = g_get_current_dir();
>-- 
>2.31.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210412/60ac8d08/attachment-0001.sig>


More information about the libvir-list mailing list