File checkinstall-add_fchmodat.patch of Package checkinstall
Catch calls to fchmodat (bnc#432497).
--- installwatch-0.7.0beta5/installwatch.c
+++ installwatch-0.7.0beta5/installwatch.c
@@ -66,6 +66,7 @@
static int (*true_chroot)(const char *);
static int (*true_creat)(const char *, mode_t);
static int (*true_fchmod)(int, mode_t);
+static int (*true_fchmodat)(int, const char *, mode_t, int);
static int (*true_fchown)(int, uid_t, gid_t);
static FILE *(*true_fopen)(const char *,const char*);
static int (*true_ftruncate)(int, TRUNCATE_T);
@@ -294,6 +295,7 @@
true_chroot = dlsym(libc_handle, "chroot");
true_creat = dlsym(libc_handle, "creat");
true_fchmod = dlsym(libc_handle, "fchmod");
+ true_fchmodat = dlsym(libc_handle, "fchmodat");
true_fchown = dlsym(libc_handle, "fchown");
true_fopen = dlsym(libc_handle, "fopen");
true_ftruncate = dlsym(libc_handle, "ftruncate");
@@ -2262,6 +2264,45 @@
return result;
}
+int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags) {
+/* Is it a system call? */
+ int result;
+ instw_t instw;
+
+ REFCOUNT;
+
+ if (!libc_handle)
+ initialize();
+
+#if DEBUG
+ debug(2,"fchmodat(%s,mode)\n",pathname);
+#endif
+
+ /* We were asked to work in "real" mode */
+ if( !(__instw.gstatus & INSTW_INITIALIZED) ||
+ !(__instw.gstatus & INSTW_OKWRAP) ) {
+ result=true_fchmodat(dirfd,pathname,mode,flags);
+ return result;
+ }
+
+ instw_new(&instw);
+ instw_setpath(&instw,pathname);
+
+#if DEBUG
+ instw_print(&instw);
+#endif
+
+ backup(instw.truepath);
+ instw_apply(&instw);
+
+ result = true_fchmodat(dirfd,instw.translpath,mode,flags);
+ logg("%d\tfchmodat\t%s\t#%s\n",result,instw.reslvpath,error(result));
+
+ instw_delete(&instw);
+
+ return result;
+}
+
int fchown(int fd, uid_t owner, gid_t group) {
int result;