summaryrefslogtreecommitdiff
path: root/src/vipw.c
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2022-01-21 23:41:15 +0100
committerBalint Reczey <balint@balintreczey.hu>2022-01-21 23:41:15 +0100
commit0c04b92a9afe5e09a20307d8a5ec98d97ed00f47 (patch)
tree27f51b8f32e23b65d2ef2bbbae00c19fd036e81d /src/vipw.c
parent749c1780621163ca5108f164861324bafa9e0ae8 (diff)
downloadshadow-0c04b92a9afe5e09a20307d8a5ec98d97ed00f47.tar.gz
New upstream version 4.11.1+dfsg1upstream/4.11.1+dfsg1
Diffstat (limited to 'src/vipw.c')
-rw-r--r--src/vipw.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/vipw.c b/src/vipw.c
index 94185c3d..8c97f4bc 100644
--- a/src/vipw.c
+++ b/src/vipw.c
@@ -1,27 +1,14 @@
/*
vipw, vigr edit the password or group file
with -s will edit shadow or gshadow file
-
- Copyright (c) 1997 , Guy Maor <maor@ece.utexas.edu>
- Copyright (c) 1999 - 2000, Marek Michałkiewicz
- Copyright (c) 2002 - 2006, Tomasz Kłoczko
- Copyright (c) 2007 - 2013, Nicolas François
- All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ *
+ * SPDX-FileCopyrightText: 1997 , Guy Maor <maor@ece.utexas.edu>
+ * SPDX-FileCopyrightText: 1999 - 2000, Marek Michałkiewicz
+ * SPDX-FileCopyrightText: 2002 - 2006, Tomasz Kłoczko
+ * SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include <config.h>
@@ -53,6 +40,7 @@
#include <tcb.h>
#include "tcbfuncs.h"
#endif /* WITH_TCB */
+#include "shadowlog.h"
#define MSG_WARN_EDIT_OTHER_FILE _( \
"You have modified %s.\n"\
@@ -63,7 +51,6 @@
* Global variables
*/
const char *Prog;
-FILE *shadow_logfd = NULL;
static const char *filename, *fileeditname;
static bool filelocked = false;
@@ -349,6 +336,9 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
sigprocmask(SIG_BLOCK, &mask, &omask);
}
+ /* set SIGCHLD to default for waitpid */
+ signal(SIGCHLD, SIG_DFL);
+
for (;;) {
pid = waitpid (pid, &status, WUNTRACED);
if ((pid != -1) && (WIFSTOPPED (status) != 0)) {
@@ -482,7 +472,8 @@ int main (int argc, char **argv)
bool do_vipw;
Prog = Basename (argv[0]);
- shadow_logfd = stderr;
+ log_set_progname(Prog);
+ log_set_logfd(stderr);
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);