]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'xget' of https://github.com/ericonr/util-linux
authorKarel Zak <kzak@redhat.com>
Thu, 29 Jul 2021 19:34:20 +0000 (21:34 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 29 Jul 2021 19:34:20 +0000 (21:34 +0200)
* 'xget' of https://github.com/ericonr/util-linux:
  lib/pwdutils: use assert to check correct usage.
  logger: use xgetlogin from pwdutils.
  wall: use xgetlogin.
  lib/pwdutils: don't use getlogin(3).

include/c.h
lib/loopdev.c
login-utils/sulogin.c
sys-utils/unshare.c
tests/expected/fdisk/bsd_0_64.BE
tests/expected/fdisk/bsd_1_0.BE

index c1e4c5ffc92b0f9c648f379fb7465e5f714b88f1..354b59e299cddc120eff24e16bfce2f02e4e4b31 100644 (file)
@@ -342,10 +342,6 @@ static inline int drop_permissions(void)
 {
        errno = 0;
 
-       /* drop supplementary groups */
-       if (setgroups(0, NULL) != 0)
-               goto fail;
-
        /* drop GID */
        if (setgid(getgid()) < 0)
                goto fail;
index 1eef15d8966286e6ae0eea07915fe1d440622d08..d9ea1d4a22ef5488921f4f5fcde1f6c64a161fd6 100644 (file)
@@ -1360,7 +1360,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
        if (ioctl(dev_fd, LOOP_CONFIGURE, &lc->config) < 0) {
                rc = -errno;
                errsv = errno;
-               if (errno != EINVAL) {
+               if (errno != EINVAL && errno != ENOTTY) {
                        DBG(SETUP, ul_debugobj(lc, "LOOP_CONFIGURE failed: %m"));
                        goto err;
                }
index 0559eebc5f8433749d10957ed445e817fd50c7a3..8f47fe31d8a1b7ab1dffc7e6d80cef1bc2c61548 100644 (file)
@@ -680,6 +680,7 @@ static char *getpasswd(struct console *con)
        tc = 0;
        ret = pass;
 
+       ret = pass;
        tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
        tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP|ISIG);
 
index 39e2895afd665d44077d832c3c0f06a455e97b46..8e61221da82417a13a099826a0a669723afa89fb 100644 (file)
@@ -650,8 +650,18 @@ int main(int argc, char *argv[])
                err(EXIT_FAILURE, _("cannot chdir to '%s'"), newdir);
 
        if (procmnt) {
-               if (!newroot && mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL) != 0)
-                       err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt);
+               /* When not changing root and using the default propagation flags
+                  then the recursive propagation change of root will
+                  automatically change that of an existing proc mount. */
+               if (!newroot && propagation != (MS_PRIVATE|MS_REC)) {
+                       int rc = mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL);
+
+                       /* Custom procmnt means that proc is very likely not mounted, causing EINVAL.
+                          Ignoring the error in this specific instance is considered safe. */
+                       if(rc != 0 && errno != EINVAL)
+                               err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt);
+               }
+
                if (mount("proc", procmnt, "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL) != 0)
                        err(EXIT_FAILURE, _("mount %s failed"), procmnt);
        }
index 6b5b44d9e98c9b6be4afc8dff7ec0e16ab5047da..4f41d03b0482ab3760fdca9050bd0eeeccec2845 100644 (file)
@@ -47,16 +47,16 @@ I/O size (minimum/optimal): 512 bytes / <removed> bytes
 Disklabel type: dos
 Disk identifier: <removed>
 
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  4095    2048   1M 83 Linux
+Device     Boot Start   End Sectors Id Type  Start-C/H/S End-C/H/S Attrs
+<removed>1       2048  4095    2048 83 Linux     0/32/33    0/65/1 
 -------------------
 
 Create 2nd primary partition
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e 83 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 83 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -66,8 +66,8 @@ Set 2nd partition type
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -82,17 +82,17 @@ I/O size (minimum/optimal): 512 bytes / <removed> bytes
 Disklabel type: dos
 Disk identifier: <removed>
 
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  4095    2048   1M 83 Linux
-<removed>2       4096 20479   16384   8M a5 FreeBSD
+Device     Boot Start   End Sectors Id Type    Start-C/H/S End-C/H/S Attrs
+<removed>1       2048  4095    2048 83 Linux       0/32/33    0/65/1 
+<removed>2       4096 20479   16384 a5 FreeBSD      0/65/2    1/70/5 
 -------------------
 
 Create default BSD
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -144,8 +144,8 @@ Command (m for help):
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
index 3092a9b9cd4a26b0faf1620d6cbd3a4f99465120..4c201b06a0646ead070e0c5caae331d13ede663f 100644 (file)
@@ -47,16 +47,16 @@ I/O size (minimum/optimal): 512 bytes / <removed> bytes
 Disklabel type: dos
 Disk identifier: <removed>
 
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  4095    2048   1M 83 Linux
+Device     Boot Start   End Sectors Id Type  Start-C/H/S End-C/H/S Attrs
+<removed>1       2048  4095    2048 83 Linux     0/32/33    0/65/1 
 -------------------
 
 Create 2nd primary partition
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e 83 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 83 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -66,8 +66,8 @@ Set 2nd partition type
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -82,17 +82,17 @@ I/O size (minimum/optimal): 512 bytes / <removed> bytes
 Disklabel type: dos
 Disk identifier: <removed>
 
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  4095    2048   1M 83 Linux
-<removed>2       4096 20479   16384   8M a5 FreeBSD
+Device     Boot Start   End Sectors Id Type    Start-C/H/S End-C/H/S Attrs
+<removed>1       2048  4095    2048 83 Linux       0/32/33    0/65/1 
+<removed>2       4096 20479   16384 a5 FreeBSD      0/65/2    1/70/5 
 -------------------
 
 Create default BSD
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
@@ -144,8 +144,8 @@ Command (m for help):
 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000001b0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 20  |............... |
-000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 04  |!..A............|
-000001d0  01 3e a5 13 41 36 00 10  00 00 00 40 00 00 00 00  |.>..A6.....@....|
+000001c0  21 00 83 41 01 00 00 08  00 00 00 08 00 00 00 41  |!..A...........A|
+000001d0  02 00 a5 46 05 01 00 10  00 00 00 40 00 00 00 00  |...F.......@....|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|