summaryrefslogtreecommitdiffstats
path: root/login-utils/vipw.c
Commit message (Collapse)AuthorAgeFilesLines
* vipw: make vim writebackup mode workSami Kerola2012-08-061-0/+12
| | | | | | | | | | | | Some editors, such as Vim with 'writebackup' mode enabled, use "atomic save" in which the old file is deleted and a new one with the same name created in its place. The vipw tries to detect if such happen by looking hard temporary file link count, when it is zero reopen temporary file by using it's path. Reported-by: Mantas Mikulėnas <grawity@gmail.com> References: http://www.spinics.net/lists/util-linux-ng/msg06666.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: add noreturn function attributeSami Kerola2012-07-261-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fileutils: xmkstemp() interface changeDave Reisner2012-06-021-1/+2
| | | | | | | | | | | We can not let the user control where TMPDIR is for this tempfile. This will be where we write the updated passwd file, and must be capable of being moved atomically with rename(2). Therefore, it cannot be on a different device, or setpwnam() and vipw/vigr programs will invariably fail with EXDEV. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* login-utils: add missing header, fix setpwnam.c fclose logicKarel Zak2012-04-111-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: verify writing to streams was successfulSami Kerola2012-04-041-2/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fileutils: differentiate xmkstemp and xfmkstempSami Kerola2012-03-181-1/+1
| | | | | | | | | | | | Let developer to choose, case by case, what sort of return value is best in her code. The xmkstemp() is for users who want file descriptor as return value of the function, xfmkstemp() will return FILE pointer. Proposed-By: Karel Zak <kzak@redhat.com> CC: Davidlohr Bueso <dave@gnu.org> Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: use xmkstemp() and lckpwdf()Sami Kerola2012-03-181-62/+38Star
| | | | | | Get rid private locking schema and use libc instead. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: use rpmatch to yes/no questionSami Kerola2012-03-181-2/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add deprecation commentsSami Kerola2012-03-181-0/+9
| | | | | | | Markup deprecation to command header to avoid people wasting time in fixing these utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: use xalloc.hKarel Zak2012-02-061-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: don't modify environment, check strtok() return valueKarel Zak2012-02-011-4/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: fix coding styleSami Kerola2011-11-291-84/+83Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: stop printing non-sense version stringSami Kerola2011-11-231-3/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: use libc error printing facilitiesSami Kerola2011-11-231-32/+17Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: use %m in format string instead of %s and strerror(errno)Petr Uzel2011-09-271-2/+1Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+1
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* vipw: fix warn_unused_result gcc warningKarel Zak2010-12-101-1/+3
| | | | | | | vipw.c:194:6: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: use EXIT_* and err()Marek Polacek2010-12-101-22/+22
| | | | | | | [kzak@redhat.com: - fix one error message] Signed-off-by: Marek Polacek <mmpolacek@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-1/+1
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* replace bcopy,bzero,index and rindexDaniel Mierswa2009-08-171-2/+2
| | | | | | | | | Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008. Replaced with memmove,memset,strchr and strrchr. Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* selinux: is_selinux_enabled() returns 0, 1 and -1Karel Zak2008-07-011-1/+1
| | | | | | | | | | Unfortunately, the current libselinux implementation of is_selinux_enabled() returns -1 on error. This behavior is undocumented. The proper solution is to use "if (is_selinux_enabled() > 0)". Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: fix permissions (600->400) for edited /etc/[g]shodow filesKarel Zak2007-02-151-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-2/+2
|
* Imported from util-linux-2.12a tarball.Karel Zak2006-12-071-0/+24
|
* Imported from util-linux-2.11m tarball.Karel Zak2006-12-071-82/+87
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-29/+65
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-17/+11Star
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-10/+23
|
* Imported from util-linux-2.9i tarball.Karel Zak2006-12-071-3/+2Star
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-14/+10Star
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-48/+87
|
* Imported from util-linux-2.5 tarball.Karel Zak2006-12-071-5/+11
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+252