summaryrefslogtreecommitdiffstats
path: root/term-utils
Commit message (Collapse)AuthorAgeFilesLines
...
* Use --help suggestion on invalid optionKarel Zak2016-12-196-7/+7
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: replace FTP by HTTPS in kernel.org URLsSébastien Helleu2016-12-198-8/+8
| | | | | | | The links to ftp://ftp.kernel.org/ are replaced by https://www.kernel.org/. Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: various pages: Use 'UID" and "GID", not "uid" and "gid" in man pagesMichael Kerrisk2016-12-091-1/+1
| | | | Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
* docs: various pages: Use consistent terminology (set-user-ID and set-group-ID)Michael Kerrisk2016-12-091-1/+2
| | | | | | | | | | Use consistent terminology for set-user-ID and set-group-ID bits. There's much inconsistency in the pages. "suid", "set-user-identifier", "setuid". Stick with one terminology, "set-user-ID" and set-grout-ID, as suggested in man-pages(7). Signed-off-by: <mtk.man-pages@gmail.com>
* docs: various pages: Format pathnames as italic (.I)Michael Kerrisk2016-12-091-5/+5
| | | | | | | | | In the majority of pages, pathnames are formatted as Italic, which is the norm. However, there are several cases where they are formatted as bold. This patch fixes a number of those exceptions. Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
* wall: remove unnecessary includeKarel Zak2016-12-081-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: re-add utmp.h for Debian GNU/kFreeBSDRuediger Meier2016-12-071-1/+7
| | | | | | | It's needed there to get login_tty(). On normal FreeBSD we would need libutil.h. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login-utils: switch to utmpx.hRuediger Meier2016-12-073-28/+28
| | | | | | | | Now the build will fail on many non-Linux systems because utmpx.h is available everywhere but we still use non-POSIX features. We'll fix this next commit. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* agetty: remove obsolete HAVE_UPDWTMP fallbackRuediger Meier2016-12-071-20/+1Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login-utils: avoid using the defined utmp sizes.Ruediger Meier2016-12-071-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login-utils: remove _HAVE_UT_TV fallbackRuediger Meier2016-12-071-4/+0Star
| | | | | | | | | | _HAVE_UT_TV is glibc only. Moreover we want to move to utmpx where timeval is standard. Now utmp/subsecond (1173d0a6) should work on all supported systems. CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* wall: check -g GIDKarel Zak2016-12-021-1/+7
| | | | | | Based on comments from Sami Kerola. Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: add --group optionJim Patterson2016-12-022-1/+82
| | | | | | | | | | | | | | | | The wall command on AIX supports a "-g" option to limit the message to a group of users by gid. Add compatibility to the Linux version. Thanks to Sami Kerola <kerolasa@iki.fi> for an initial skeleton implementation. [kzak@redhat.com: - rename max to ngroups - add free_group_workspace() - some cosmetic changes] Reference: http://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.cmds6/wall.htm Signed-off-by: Jim Patterson <jimp@wegrok.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: spelling, always use "cannot" instead of "can not"Ruediger Meier2016-11-302-2/+2
| | | | | | Just to be consistent ... Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Place SEE ALSO entries in orderMichael Kerrisk (man-pages)2016-11-293-5/+5
| | | | | | | | | | | | This patch does only the following: * Order SEE ALSO entries first by section name, then alphabetically within section * Adds one or two missing commas in SEE ALSO lists * Removes one or two periods that were (inconsistently) used at the end of SEE ALSO lists. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* misc: always check setenv(3) return valueSami Kerola2016-08-121-1/+3
| | | | | | At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: move unreachable code to pre-processor #else segment [oclint]Sami Kerola2016-07-211-2/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: fix declarations shadowing variables in the global scope [oclint]Sami Kerola2016-07-211-40/+40
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-212-20/+13Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: call uname() only when necessaryKarel Zak2016-07-201-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix \S usageKarel Zak2016-07-201-10/+15
| | | | | | | | If \S without argument used then uninitialized 'varname' compared with ANSI_COLOR. Addresses: https://github.com/karelzak/util-linux/issues/329 Signed-off-by: Karel Zak <kzak@redhat.com>
* write: don't use strftime()Karel Zak2016-07-141-6/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: try to find tty in get_terminal_name()Sami Kerola2016-07-041-13/+3Star
| | | | | | | | Try all standard terminal input/output file descriptors when finding tty name in get_germinal_name(). This should make all invocations of the function as robust as they can get. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: stop removing and adding /dev/ in front of tty stringSami Kerola2016-07-042-43/+39Star
| | | | | | | | | | | Add both path and tty name representations of tty's to control structure, that point to same string beginning from different depths. This way there is no need to removing and adding /dev/ in front of tty string all the time. Secondly this change makes it possible to use of get_terminal_name() from ttyutils.c. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: tell when effective gid and tty path group mismatchSami Kerola2016-07-041-2/+7
| | | | | | | | | | | | | | | | | | Most commonly this error happens when write(1) executable does not have correct group ownership and setgid bit. The earlier message was unclear what exactly was wrong. $ mesg is y $ write testuser write: you have write permission turned off Alternatively the 'getegid() == s.st_gid' could be considered unnecessary. Afterall if to write to destination tty is denied that does not go unnoticed at thet time when tty is opened. Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: improve coding styleSami Kerola2016-07-041-36/+35Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: remove PUTC macroSami Kerola2016-07-041-10/+5Star
| | | | | | | | Function like macros make following the execution flow unnecessarily difficult, and deserves to be removed. Requested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: make timestamp to be obviously just a clock timeSami Kerola2016-07-011-8/+9
| | | | | | | | | | By looking the code one will had hard time knowing that a slice of ctime() from characters 11 to 16 is HH:MM time format. Use of strftime("%H:%M") makes this a lot less mysterious. In same go make \007 hex printouts to be \a that is the same thing: alarm. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: remove unnecessary utmp variablesSami Kerola2016-07-011-17/+11Star
| | | | | | | | | | | glibc documentation tells getutent() calls are not thread safe, and recommends to copy the context of the structures when information is wished to be stored. This leads to excessive copying, that in this case is not relevant. write(1) is single threaded program and there is no reason to assume this would change in future. Reference: http://www.gnu.org/software/libc/manual/html_node/Manipulating-the-Database.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: improve function and variable namesSami Kerola2016-07-011-38/+35Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: add control structure to clarify what is going onSami Kerola2016-07-011-42/+54
| | | | | | This is done purely an improve readability of the source code. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: run atexit() checks at the end of executionSami Kerola2016-07-011-12/+17
| | | | | | | | | Earlier use of _exit() caused program to terminate abnormally from atexit() perspective and standard file descriptor close checks did not run resulting to blindness if writes were successful, or not. Easy fix is to avoid running _exit() altogether. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: use xstrncpy() from strutils.hSami Kerola2016-07-011-2/+2
| | | | | | | | Earlier if the tty path was exactly length of the maximum ut_line then last character of the path was overwrote by \0. This is in practise theoretical bug, as it is unheard that a tty device path could be 32 characters long. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: set atime value in term_chk() only when neededSami Kerola2016-07-011-4/+4
| | | | | | The search_utmp() is needs atime but main() does not, so remove the later. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: remove pointless fileno(3) callsSami Kerola2016-07-011-6/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: get rid of function prototypesSami Kerola2016-07-011-141/+132Star
| | | | | | | Marking functions static and writing them in order where functions are introduced before use is enough. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* write: remove unused variableSami Kerola2016-07-011-4/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: don't modify argv[] when parse speedsKarel Zak2016-06-301-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-314-8/+8
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* build-sys: add --disable-plymouth-supportKarel Zak2016-05-261-2/+5
| | | | | | | | The plymouth support depends on Linux specific SOCK_* flags and all the feature is probably unnecessary in some cases (non-plymouth distros, etc.) Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: agetty: use the plymouth local protocol instead the plymouth binaryWerner Fink2016-05-201-42/+6Star
| | | | | | | | | | | | | for stopping plymouthd. That do not depend on the existence of the plymouth binary if it e.g. becomes uninstalled or an other service is providing plymouthd facilities. [kzak@redhat.com: - fix compiler warnings [-Wpointer-sign] - use sizeof() for write_all() - cast to char* for read_all] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* script: improve coding style and the "done" messageKarel Zak2016-05-181-7/+5Star
| | | | | | Don't print the "done" message if the file does not exist. Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove unnecessary translation stringSami Kerola2016-05-091-8/+8
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: de-duplicate color option string parsingKarel Zak2016-05-091-44/+36Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* write: fix setuid related regressionWayne Pollock2016-05-071-7/+7
| | | | | | | | | | | | | | | | | | The write(1) is commonly a setuid binary, because common users cannot by default write to each others terminals. Since the commit in reference, that is part of releases v2.24 to v2.28, the write(1) has used access(2) to check capability to write to a destination terminal. The catch is that access(2) uses real UID and GID to when performing the accessibility. The obvious correction is to avoid access(2) when in context of setuid binaries. As a smaller fix, but equally important fix, ensure the 'msgsok' variable is initialized to indicate no access. Uninitialized variable will almost certainly do wrong thing at the time of check. Breaking-commit: 0233a8ea18bec17dd59cfe1fec8281 Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Wayne Pollock <profwaynepollock@gmail.com>
* scriptreplay: avoid re-implementing strtod_or_err()Sami Kerola2016-05-052-13/+5Star
| | | | | | And use isnan() to detect NaN. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* scriptreplay: improve error messageSami Kerola2016-05-051-2/+2
| | | | | | | Use human numbering for lines - that is start counting from 1. And tell in error message what the number means. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: check status of writes when closing outputsSami Kerola2016-04-171-2/+4
| | | | | | | This should make possible output issues more obvious, for example when a disk will get full. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: avoid trying fclose(NULL)Sami Kerola2016-04-171-1/+2
| | | | | | | | | | | | | Here is a one-liner to reproduce the issue. $ mkdir example && cd example && chmod 0500 . && script Script started, file is typescript script: cannot open typescript: Permission denied Script done, file is typescript Segmentation fault (core dumped) Addresses: https://bugs.launchpad.net/bugs/1537518 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: close file descriptors on execSami Kerola2016-04-171-6/+7
| | | | | | | | | The commands spawned from script(1) will never need access various file descriptors the script(1) is using. Reviewed-by: Ruediger Meier <sweet_f_a@gmx.de> Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>