diff options
author | Garrett D'Amore <garrett@nexenta.com> | 2010-11-15 20:03:27 -0800 |
---|---|---|
committer | Garrett D'Amore <garrett@nexenta.com> | 2010-11-15 20:03:27 -0800 |
commit | 4656d4747c8743290bfbe910c64cd75eb4e4af8d (patch) | |
tree | 241d8b3f0b8796e33937c6a27c670eba002f8f04 /usr/src/lib/libadm/common/putdev.c | |
parent | 60bec29ea42d65ac648c69b0fb189273e286ca57 (diff) | |
download | illumos-joyent-4656d4747c8743290bfbe910c64cd75eb4e4af8d.tar.gz |
420 remove patch (sparse package) support from svr4 pkg
421 libpkg and libadm need to be lint clean
Reviewed by: gwr@nexenta.com
Reviewed by: peter.tribble@gmail.com
Approved by: gwr@nexenta.com
Diffstat (limited to 'usr/src/lib/libadm/common/putdev.c')
-rw-r--r-- | usr/src/lib/libadm/common/putdev.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/usr/src/lib/libadm/common/putdev.c b/usr/src/lib/libadm/common/putdev.c index 5d0e7dc562..8ca5bd50cb 100644 --- a/usr/src/lib/libadm/common/putdev.c +++ b/usr/src/lib/libadm/common/putdev.c @@ -26,8 +26,10 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ +/* + * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + */ -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ /* LINTLIBRARY */ /* @@ -78,12 +80,9 @@ * * TDTABNM Name of the temporary device table (in the * directory of the existing table) - * TDTABNMLN Number of characters added to the directory - * name -- the length of the device table temp name */ #define TDTABNM "%sdevtab.%6.6d" -#define TDTABNMLN 13 /* @@ -190,21 +189,20 @@ opennewdevtab(char **pname) /* A(ptr to temp filename's path) */ *(p+1) = '\0'; dirname = oldname; } else dirname = "./"; - if (buf = malloc(TDTABNMLN + strlen(dirname) + 1)) { - - /* - * Build the name of the temp device table and open the - * file. We must reset the owner, group and perms to those - * of the original devtab file. - */ - (void) sprintf(buf, TDTABNM, dirname, getpid()); - if (fp = fopen(buf, "w")) { - *pname = buf; - (void) fchmod(fileno(fp), sbuf.st_mode & 0777); - (void) fchown(fileno(fp), sbuf.st_uid, sbuf.st_gid); - } else { - free(buf); - } + if (asprintf(&buf, TDTABNM, dirname, getpid()) >= 0) { + + /* + * Build the name of the temp device table and + * open the file. We must reset the owner, group + * and perms to those of the original devtab file. + */ + if (fp = fopen(buf, "w")) { + *pname = buf; + (void) fchmod(fileno(fp), sbuf.st_mode & 0777); + (void) fchown(fileno(fp), sbuf.st_uid, sbuf.st_gid); + } else { + free(buf); + } } /* |