libcap-ng/libcap-ng-0.6.5-device.patch
2010-06-17 18:46:43 +00:00

42 lines
1.1 KiB
Diff

diff -urp libcap-ng-0.6.5.orig/utils/filecap.c libcap-ng-0.6.5/utils/filecap.c
--- libcap-ng-0.6.5.orig/utils/filecap.c 2010-06-17 13:19:21.000000000 -0400
+++ libcap-ng-0.6.5/utils/filecap.c 2010-06-17 14:25:07.000000000 -0400
@@ -41,12 +41,15 @@ static void usage(void)
exit(1);
}
-static int check_file(const char *file,
- const struct stat *sb_unused __attribute__ ((unused)),
- int flag_unused __attribute__ ((unused)),
+static int check_file(const char *fpath,
+ const struct stat *sb,
+ int typeflag_unused __attribute__ ((unused)),
struct FTW *s_unused __attribute__ ((unused)))
{
- int fd = open(file, O_RDONLY);
+ if (S_ISREG(sb->st_mode) == 0)
+ return FTW_CONTINUE;
+
+ int fd = open(fpath, O_RDONLY);
if (fd >= 0) {
capng_results_t rc;
@@ -58,7 +61,7 @@ static int check_file(const char *file,
header = 1;
printf("%-20s capabilities\n", "file");
}
- printf("%s ", file);
+ printf("%s ", fpath);
if (rc == CAPNG_FULL)
printf("full");
else
@@ -68,7 +71,7 @@ static int check_file(const char *file,
}
close(fd);
}
- return 0;
+ return FTW_CONTINUE;
}