5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER START
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The contents of this file are subject to the terms of the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Common Development and Distribution License (the "License").
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You may not use this file except in compliance with the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * or http://www.opensolaris.org/os/licensing.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * See the License for the specific language governing permissions
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and limitations under the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * When distributing Covered Code, include this CDDL HEADER in each
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If applicable, add the following below this CDDL HEADER, with the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER END
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Use is subject to license terms.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_CHDIR "unable to chdir back to <%s>, errno=%d"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_GETCWD "unable to determine the current working directory, " \
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (!device_name || !*device_name) /* NULL or empty */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (dev_ok == 1 && listdev(np) != (char **) NULL) /* device.tab */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (!strncmp(np, "/dev", 4)) /* /dev path */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((cwd = getcwd(NULL, PATH_MAX)) == NULL) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (realpath(np, new_device_name) == NULL) { /* path */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (void) sprintf(new_device_name, "%s/%s", cwd, np);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((np = strdup(new_device_name)) == NULL)