- The type of return value of setmode is a void * and getmode takes it,

rather than mode_t *.
- Free the storage allocated by setmode unless it is obvious that program
  exits immediately.
This commit is contained in:
enami 2000-10-10 14:30:40 +00:00
parent d4f8f51f40
commit e92c3f2867
5 changed files with 19 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkdir.c,v 1.23 1999/05/26 15:51:09 kleink Exp $ */
/* $NetBSD: mkdir.c,v 1.24 2000/10/10 14:30:40 enami Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94";
#else
__RCSID("$NetBSD: mkdir.c,v 1.23 1999/05/26 15:51:09 kleink Exp $");
__RCSID("$NetBSD: mkdir.c,v 1.24 2000/10/10 14:30:40 enami Exp $");
#endif
#endif /* not lint */
@ -68,7 +68,7 @@ main(argc, argv)
char *argv[];
{
int ch, exitval, pflag;
mode_t *set;
void *set;
mode_t mode, dir_mode;
(void)setlocale(LC_ALL, "");
@ -92,6 +92,7 @@ main(argc, argv)
if ((set = setmode(optarg)) == NULL)
errx(1, "invalid file mode: %s", optarg);
mode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO);
free(set);
break;
case '?':
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: function.c,v 1.33 2000/03/16 18:44:29 enami Exp $ */
/* $NetBSD: function.c,v 1.34 2000/10/10 14:30:41 enami Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "from: @(#)function.c 8.10 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: function.c,v 1.33 2000/03/16 18:44:29 enami Exp $");
__RCSID("$NetBSD: function.c,v 1.34 2000/10/10 14:30:41 enami Exp $");
#endif
#endif /* not lint */
@ -979,6 +979,7 @@ c_perm(argvp, isok)
err(1, "-perm: %s: illegal mode string", perm);
new->m_data = getmode(set, 0);
free(set);
return (new);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfifo.c,v 1.8 1997/10/19 05:11:54 lukem Exp $ */
/* $NetBSD: mkfifo.c,v 1.9 2000/10/10 14:30:41 enami Exp $ */
/*
* Copyright (c) 1990, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 1/5/94";
#endif
__RCSID("$NetBSD: mkfifo.c,v 1.8 1997/10/19 05:11:54 lukem Exp $");
__RCSID("$NetBSD: mkfifo.c,v 1.9 2000/10/10 14:30:41 enami Exp $");
#endif /* not lint */
#include <stdio.h>
@ -65,7 +65,7 @@ main(argc, argv)
char *argv[];
{
int ch, exitval;
void * set;
void *set;
mode_t mode;
setlocale (LC_ALL, "");
@ -85,7 +85,8 @@ main(argc, argv)
/* In symbolic mode strings, the + and - operators are
interpreted relative to an assumed initial mode of
a=rw. */
mode = getmode (set, 0666);
mode = getmode(set, 0666);
free(set);
break;
case '?':
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: xinstall.c,v 1.41 2000/07/27 03:57:50 cgd Exp $ */
/* $NetBSD: xinstall.c,v 1.42 2000/10/10 14:30:41 enami Exp $ */
/*
* Copyright (c) 1987, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
#if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#else
__RCSID("$NetBSD: xinstall.c,v 1.41 2000/07/27 03:57:50 cgd Exp $");
__RCSID("$NetBSD: xinstall.c,v 1.42 2000/10/10 14:30:41 enami Exp $");
#endif
#endif /* not lint */
@ -106,7 +106,7 @@ main(argc, argv)
char *argv[];
{
struct stat from_sb, to_sb;
mode_t *set;
void *set;
u_long fset;
u_int iflags;
int ch, no_target;
@ -183,6 +183,7 @@ main(argc, argv)
if (!(set = setmode(optarg)))
errx(1, "%s: invalid file mode", optarg);
mode = getmode(set, 0);
free(set);
break;
case 'o':
owner = optarg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: spec.c,v 1.18 1999/12/01 22:14:46 wennmach Exp $ */
/* $NetBSD: spec.c,v 1.19 2000/10/10 14:30:41 enami Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: spec.c,v 1.18 1999/12/01 22:14:46 wennmach Exp $");
__RCSID("$NetBSD: spec.c,v 1.19 2000/10/10 14:30:41 enami Exp $");
#endif
#endif /* not lint */
@ -179,7 +179,7 @@ set(t, ip)
char *kw, *val, *md;
struct group *gr;
struct passwd *pw;
mode_t *m;
void *m;
int value;
char *ep;