Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Found 3 const char */char * conflicts in tclUnixFCmd.c

Closed / Fixed218136ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:53:35
OriginalBugID: 2054 Bug
Version: 8.1b3
SubmitDate: '1999-05-12'
LastModified: '1999-09-15'
Severity: CRIT
Status: Closed
Submitter: pat
ChangedBy: hobbs
OS: Other
OSVersion: UNICOS 10.0.0.2 & 10.0.0.3
Machine: NA
FixedDate: '2000-10-25'
ClosedDate: '1999-09-15'


Name:

Richard Paynter


CustomShell:

Modified tclUnixFCmd.c as shown above.


ReproducibleScript:

Modified lines 373, 378, and 385, as shown below due to fatal

    assignments.


    373: length = readlink(src, link, sizeof(link)); ==> length = \

            readlink((char *)src, link, sizeof(link))


    378: if (symlink(link, dst) < 0) { ==> if (symlink(link, (char *)dst) <

    0) {


    385: if (mknod(dst, srcStatBuf.st_mode, ==> if (mknod((char *)dst, \

            srcStatBuf.st_mode,


ObservedBehavior:

Compilation aborted on these lines, until I explicitly typecast src and

    dst as

    (char *), rather than leaving them as (const char *)


DesiredBehavior:

Successful compilation of tclUnixFCmd.c


Patch:

*** tclUnixFCmd.c.old   Wed May 12 14:21:02 1999

--- tclUnixFCmd.c       Wed May 12 14:15:55 1999

***************

*** 370,381 ****

            char link[MAXPATHLEN];

            int length;


!           length = readlink(src, link, sizeof(link)); /* INTL: Native. */

            if (length == -1) {

                return TCL_ERROR;

            }

            link[length] = '\0';

!           if (symlink(link, dst) < 0) {               /* INTL: Native. */

                return TCL_ERROR;

            }

            break;

--- 370,381 ----

            char link[MAXPATHLEN];

            int length;


!           length = readlink((char *)src, link, sizeof(link)); /* INTL: Native.

 */

            if (length == -1) {

                return TCL_ERROR;

            }

            link[length] = '\0';

!           if (symlink(link, (char *)dst) < 0) {               /* INTL: Native.

 */

                return TCL_ERROR;

            }

            break;

***************

*** 382,388 ****

        }

          case S_IFBLK:

          case S_IFCHR: {

!           if (mknod(dst, srcStatBuf.st_mode,          /* INTL: Native. */

                    srcStatBuf.st_rdev) < 0) {

                return TCL_ERROR;

            }

--- 382,388 ----

        }

          case S_IFBLK:

          case S_IFCHR: {

!           if (mknod((char *)dst, srcStatBuf.st_mode,          /* INTL: Native.

 */

                    srcStatBuf.st_rdev) < 0) {

                return TCL_ERROR;

            }


PatchFiles:

tclUnixFCmd.c




This looks to be a compiler/system bug, because looking at
Linux, Solaris and IRIX, they all define this to be a
const char *. 
-- 09/15/1999 hobbs
welch Closed ticket [218136ffff]. [History diff]2000-10-26 08:15:55
dgp Ticket [218136ffff]: 3 changes [History diff]2001-04-17 05:54:46
Log in (anonymous is fine) to add a comment.