]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-utils: Use lstat instead of stat for ply_file_exists
authorRay Strode <rstrode@redhat.com>
Thu, 28 Dec 2023 17:10:57 +0000 (12:10 -0500)
committerRay Strode <halfline@gmail.com>
Thu, 28 Dec 2023 17:31:48 +0000 (17:31 +0000)
If a file is a symlink, we usually want to follow it, so
testing the symlink itself, is less than optimal.

This commit switches to lstat instead of stat.

src/libply/ply-utils.c

index 95b505b170f6ee40e60c2bbf6cafccd238a8c99f..a71d8de80c6492380e07dd288b57b0f598fad4e8 100644 (file)
@@ -518,7 +518,7 @@ ply_file_exists (const char *file)
 {
         struct stat file_info;
 
-        if (stat (file, &file_info) < 0)
+        if (lstat (file, &file_info) < 0)
                 return false;
 
         return S_ISREG (file_info.st_mode);