Codebase list pseudo / 735ac1b
Fix mknod(...) with no file type bits mknod(2) automatically defaults to S_IFREG if not given an explicit file type, so pseudo should too. Otherwise, GNU tar can (for some reason, it mostly does this when extracting xattrs?) invoke mknod instead of open with O_CREAT to create a file, and just provide the permission bits, and pseudo creates a "weird file" with no type bits in the database, which is unhelpful. Signed-off-by: Peter Seebach <peter.seebach@windriver.com> Peter Seebach 8 years ago
4 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 2016-01-22:
1 * (seebs) Mask in S_IFREG when mknod called with no S_IFMT bits.
2
03 2015-09-22:
14 * (seebs) Fix modes after fopen/fopen64.
25
1010
1111 /* mask out mode bits appropriately */
1212 mode = mode & ~pseudo_umask;
13 /* if you don't specify a type, assume regular file */
14 if (!(mode & S_IFMT)) {
15 mode |= S_IFREG;
16 }
17 pseudo_debug(PDBGF_FILE, "xmknodat creating '%s', mode 0%o\n",
18 path ? path : "<no name>", (int) mode);
1319
1420 /* we don't use underlying call, so _ver is irrelevant to us */
1521 (void) ver;
1111
1212 /* mask out mode bits appropriately */
1313 mode = mode & ~pseudo_umask;
14 /* if you don't specify a type, assume regular file */
15 if (!(mode & S_IFMT)) {
16 mode |= S_IFREG;
17 }
18 pseudo_debug(PDBGF_FILE, "mknodat creating '%s', mode 0%o\n",
19 path ? path : "<no name>", (int) mode);
1420
1521 #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
1622 if (dirfd != AT_FDCWD) {
10661066 msg->uid = (uid_t) -1;
10671067 msg->gid = (gid_t) -1;
10681068 #endif
1069 pseudo_debug(PDBGF_DB, "linking %s (uid -1 if xattr) for %s\n",
1069 pseudo_debug(PDBGF_DB | PDBGF_XATTR, "linking %s (uid -1 if xattr) for %s, mode 0%o\n",
10701070 msg->pathlen ? msg->path : "no path",
1071 pseudo_op_name(msg->op));
1071 pseudo_op_name(msg->op),
1072 (int) msg->mode);
10721073 pdb_link_file(msg, &row);
10731074 }
10741075 if (pdb_set_xattr(row, oldpath, oldpathlen, xattr_flags)) {