There is absolutely no reason why cfdisk should not display
cylinders beyond 1024. The number of cylinders needs to be
truncated only for the CHS field.
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Matthias Koenig [Tue, 13 Nov 2007 15:28:38 +0000 (16:28 +0100)]
mkfs.minix: add sectorsize check
Minix filesystem until version 2 has a fixed blocksize of 1024 bytes.
If you try to create a filsystem on a device with a physical sectorsize
larger than 1024 bytes, this resulting minix fs cannot be mounted,
because the physical sectorsize must be smaller than the filesystem
blocksize.
This patch adds a check for this and will refuse to create a filesystem
if the sectorsize is bigger than the blocksize.
Randy Dunlap [Tue, 16 Oct 2007 00:38:57 +0000 (17:38 -0700)]
sfdisk: cleanup 83 gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
83 warnings fixed:
sfdisk.c:249: warning: pointer targets in initialization differ in signedness
sfdisk.c:376: warning: pointer targets in passing argument 1 of 'chars_to_ulong' differ in signedness
sfdisk.c:702: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness
sfdisk.c:703: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness
sfdisk.c:1709: warning: pointer targets in passing argument 1 of 'fgets' differ in signedness
sfdisk.c:1709: warning: pointer targets in assignment differ in signedness
sfdisk.c:1714: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1714: warning: pointer targets in assignment differ in signedness
sfdisk.c:1719: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1719: warning: pointer targets in assignment differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1729: warning: pointer targets in passing argument 1 of 'index' differ in signedness
sfdisk.c:1729: warning: pointer targets in assignment differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strncmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2067: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2083: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2096: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
sfdisk.c:2154: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2155: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2156: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2167: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2168: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
sfdisk.c:2169: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Tue, 16 Oct 2007 00:38:40 +0000 (17:38 -0700)]
script: cleanup gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
script.c:239: warning: ignoring return value of 'write', declared with attribute warn_unused_result
script.c:330: warning: ignoring return value of 'write', declared with attribute warn_unused_result
script.c:331: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Tue, 16 Oct 2007 00:38:22 +0000 (17:38 -0700)]
more: cleanup gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
more.c:185: warning: passing argument 1 of 'setupterm' discards qualifiers from pointer target type
more.c:205: warning: passing argument 1 of 'tparm' discards qualifiers from pointer target type
more.c:812: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness
more.c:931: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness
more.c:1285: warning: pointer targets in passing argument 1 of 'ttyin' differ in signedness
more.c:1486: warning: pointer targets in passing argument 1 of 'ttyin' differ in signedness
more.c:1879: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Add a missing period, a missing space, a comma and a word for clarity,
plus a period and an uppercase letter to match surrounding messages.
Further add a missing call to gettext, and undo an unneeded linewrap.
When hwclock --hctosys is started very early during the system startup,
with / still mounted read-only, and there was no /etc/adjtime file,
hwclock fails creating a default adjfile full of zeroes, and prints an
error message. I believe that such zero adjfile is not necessary,
because it means exactly the same as no adjfile at all.
The attached patch prevents creation of a zero adjfile, of course unless
something gets changed (this never happens during a --hctosys).
Karel Zak [Tue, 11 Sep 2007 12:35:34 +0000 (14:35 +0200)]
mount: prevent loop mounting the same file twice
The mount syscall prevents mounting the same device twice
to the same mountpoint. When loop mounting a file, for each
file a new loop device gets allocated, which prevents the detection
of loop mounting the same file to the same mountpoint twice.
The patch adds a check to prevent double mounts, if the same loopfile
is going to be mounted with the same offset to the same mountpoint.
Karel Zak [Thu, 25 Oct 2007 10:29:51 +0000 (12:29 +0200)]
losetup: canonicalize loopfile name
When setting up a loop device, canonicalize the loop file
name. This simplifies a later identification of loop file names
when querying the loop devices.
Karel Zak [Mon, 22 Oct 2007 13:49:26 +0000 (15:49 +0200)]
mount: cleanup canonicalize() usage
This patch renames canonicalize() to canonicalize_mountpoint() and
moves this function to realpath.c where is all cannonicalize code.
The canonicalize_mountpoint() function checks for special "none",
"proc", "swap" pseudo mointpoint.
The patch also adds a new generic canonicalize() function.
KaiGai Kohei [Mon, 22 Oct 2007 08:30:19 +0000 (10:30 +0200)]
mkswap: possible to crash with SELinux relabeling support
When fgetfilecon() is failed with -ENODATA, this process does not
exit. However, "oldcontext" is not initialized in this case, so
context_new() will be called with uninitialized "oldcontext" at the
next.
Finally, it makes a segmentation fault, because context_new() have to
refer an incorrect memory region.
The attached patch fixes this matter using matchpathcon(). If we
cannot obtain actual file context due to -ENODATA, a context which is
returned by matchpathcon() is applied as oldcontext. Then, the type
of the context is relabeled to "swapfile_t" explicitly.
Signed-off-by: KaiGai Kohei <kaigai@kaigai.gr.jp> Signed-off-by: Karel Zak <kzak@redhat.com>
Pádraig Brady [Mon, 1 Oct 2007 23:22:45 +0000 (00:22 +0100)]
cal: add support for highlighting an arbitrary date
This is done by calling cal with the extra day parameter like:
cal 14 9 1752
Note the tests were updated to use the new syntax.
Note also that this patch changes the -y option
to always print a full year, even if a month or
the -[13] options are specified.
This matches the cal operation from bsdmainutils on debian
and also allows one to print a full year while
highlighting a particular date.
Karel Zak [Wed, 3 Oct 2007 21:15:03 +0000 (14:15 -0700)]
tailf: clean up gcc warnings & fix use of errno
Fix strict gcc warnings in tailf that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
tailf.c:111: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
Also, tailf uses perror() for error reporting, but it inserts
an fprintf call first, so perror() is actually reporting the
result of the fprintf() call, not the failing call; change
the code to print the message by using strerror() instead.
Builds cleanly on x86_32 and x86_64.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Mon, 8 Oct 2007 16:59:18 +0000 (09:59 -0700)]
losetup: clean up gcc warnings
Fix strict gcc warnings that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
lomount.c:98: warning: pointer targets in initialization differ in signedness
lomount.c:111: warning: format '%04x' expects type 'unsigned int', but argument 4 has type '__kernel_old_dev_t'
lomount.c:300: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
lomount.c:307: warning: pointer targets in passing argument 1 of '__builtin___snprintf_chk' differ in signedness
lomount.c:339: warning: pointer targets in passing argument 1 of 'xstrncpy' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Karel Zak [Wed, 3 Oct 2007 21:15:18 +0000 (14:15 -0700)]
mount: improve chmod & chown usage and clean up gcc warnings (fstab.c)
Fix strict gcc warnings in tailf that come from using:
("-Wall -Wp,-D_FORTIFY_SOURCE=2")
fstab.c:770: warning: ignoring return value of 'chown', declared with attribute warn_unused_result
The patch makes chmod() and chown() mandatory. We cannot rename()
temporary mtab to the final mtab when owner is not the same user as
owner of the original mtab. It's security risk.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Sat, 29 Sep 2007 08:12:06 +0000 (01:12 -0700)]
mkfs.cramfs: clean up gcc warnings
* clean up code, gcc warnings
(try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")
Builds cleanly on x86_32 and x86_64.
mkfs.cramfs.c:211: warning: pointer targets in passing argument 2 of 'MD5Update' differ in signedness
mkfs.cramfs.c:336: warning: format '%u' expects type 'unsigned int', but argument 4 has type 'size_t'
mkfs.cramfs.c:355: warning: pointer targets in assignment differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:490: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 1 of 'compress' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 3 of 'compress' differ in signedness
mkfs.cramfs.c:671: warning: pointer targets in passing argument 3 of 'do_compress' differ in signedness
mkfs.cramfs.c:824: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:872: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:880: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:885: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
mkfs.cramfs.c:889: warning: pointer targets in passing argument 2 of 'crc32' differ in signedness
mkfs.cramfs.c:896: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:896: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 4 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Randy Dunlap [Mon, 8 Oct 2007 19:15:25 +0000 (12:15 -0700)]
mount: clean up gcc warnings (mount_mntent.c)
Fix gcc warnings from:
(try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")
mount_mntent.c:28: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
mount_mntent.c:129: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:130: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:131: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
mount_mntent.c:132: warning: pointer targets in passing argument 1 of 'mangle' differ in signedness
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Karel Zak [Fri, 5 Oct 2007 10:22:13 +0000 (12:22 +0200)]
script: dies on SIGWINCH
The "doinput" process doesn't make a difference between SIGWINCH and
SIGCHILD. This process also sends unnecessary SIGWINCH to child (the
signal is ignored by child). Fixed.
chsh: should use pam_end function to terminate the PAM transaction
chsh will use PAM transaction if macros 'REQUIRE_PASSWORD' and
'HAVE_SECURITY_PAM_MISC_H' are defined, but there is no pam_end function be
used when the PAM transaction be terminated.
This patch also cleanup PAM code in chsh(1).
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>