10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER START
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The contents of this file are subject to the terms of the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Common Development and Distribution License (the "License").
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You may not use this file except in compliance with the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * See the License for the specific language governing permissions
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * and limitations under the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER END
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Use is subject to license terms.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Execute the command(s) of one Make or DMake rule
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Included files
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Workaround for NFS bug. Sometimes, when running 'chdir' on a remote
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * dmake server, it fails with "Stale NFS file handle" error.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The second attempt seems to work.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (res != 0 && (errno == ESTALE || errno == EAGAIN)) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe /* Stale NFS file handle. Try again */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * File table of contents
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowestatic void change_sunpro_dependencies_value(char *oldpath, char *newpath);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe MBSTOWCS(wcs_buffer, "SHELL");
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe shell_name = GETNAME(wcs_buffer, FIND_LENGTH);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe MBSTOWCS(wcs_buffer, shell);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if ((dmake_shell = getenv("DMAKE_SHELL")) == NULL) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Change the pathname in the value of the SUNPRO_DEPENDENCIES env variable
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * from oldpath to newpath.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowechange_sunpro_dependencies_value(char *oldpath, char *newpath)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe /* check if SUNPRO_DEPENDENCIES is set in the environment */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if ((sp_dep_value = getenv("SUNPRO_DEPENDENCIES")) != NULL) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe /* check if oldpath is indeed in the value of SUNPRO_DEPENDENCIES */
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (strncmp(oldpath, sp_dep_value, oldpathlen) == 0) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe "SUNPRO_DEPENDENCIES",