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>
Run pg(1) and type '/<CR>' which is supposed to forward search for the
previously remembered search string. pg(1) will segfault after printing
"No remembered search string:".
Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.
Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
LaMont Jones [Fri, 21 Sep 2007 20:01:04 +0000 (14:01 -0600)]
hwclock: Reintroduce hwclockfirst.sh on Debian machines. Closes: #443487
If /etc/localtime is a readable file, then set the time in hwclockfirst.sh
before mounting the root partition. Many thanks to Ted T'so for the details
(found in the bug report.)
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.
Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Fri, 7 Sep 2007 00:30:16 +0000 (20:30 -0400)]
build-sys: nls/locale handling in util-linux-ng general
On Monday 03 September 2007, Karel Zak wrote:
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
> I agree that we need a better support for compilation without
> locales, but from my point of view NLS != all locales stuff. The NLS
> support is subset only.
thinking about the input from everyone, i'd propose the attached ...
Only pull in locale.h as needed and move it to the common nls.h.
Mike Frysinger [Fri, 7 Sep 2007 00:30:16 +0000 (20:30 -0400)]
build-sys: nls/locale handling in util-linux-ng general
On Monday 03 September 2007, Karel Zak wrote:
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
> I agree that we need a better support for compilation without
> locales, but from my point of view NLS != all locales stuff. The NLS
> support is subset only.
thinking about the input from everyone, i'd propose the attached ...
Only pull in locale.h as needed and move it to the common nls.h.
mount: chain of symlinks to fstab causes use of pointer after free
Looking at the source in 'mount/realpath.c' we find that when dealing with
the second or later symlink in the chain, a memory block was free()d before
copying its contents to a newly allocated block.
When editing a disk image, fdisk wants to ask the kernel to reread the
partition table which is useless and provokes an error, a wrong exit
code and some waiting. This annoys me as I can't check the return code
in my script and because I have to wait a few seconds each time.
This trivial patch makes it only do the ioctl on block devices.
It also simplifies code by dropping some workaround for kernel 1.2.x
mount: chain of symlinks to fstab causes use of pointer after free
Looking at the source in 'mount/realpath.c' we find that when dealing with
the second or later symlink in the chain, a memory block was free()d before
copying its contents to a newly allocated block.