File apparmor-utils-filenames-in-slash of Package apparmor.import4985

From: Jeff Mahoney <jeffm@suse.com>
Subject: apparmor-utils: Fix handling of files in /
References: bnc#397883

 The separate handling of files and directories with realpath is broken.

 For files e.g. /foo, $dir ends up being empty since the / is eaten by
 the regex. realpath resolves an empty argument as the current directory,
 resulting in an incorrect path.

 There's no explanation of why the separate handling was used in the
 first place.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 utils/SubDomain.pm |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

--- a/utils/SubDomain.pm
+++ b/utils/SubDomain.pm
@@ -511,14 +511,7 @@ sub get_full_path ($) {
         }
     }
 
-    if (-f $path) {
-        my ($dir, $file) = $path =~ m/^(.*)\/(.+)$/;
-        $path = realpath($dir) . "/$file";
-    } else {
-        $path = realpath($path);
-    }
-
-    return $path;
+    return realpath($path);
 }
 
 sub findexecutable ($) {
openSUSE Build Service is sponsored by