Changeset 18671 for trunk/base


Ignore:
Timestamp:
Jul 22, 2006, 3:08:58 AM (18 years ago)
Author:
pguyot (Paul Guyot)
Message:

More debug code.
Removed the execve workaround now that I figured out the problem was pclose closing fd 3 even if popen didn't open fd 3 (I can only reproduce this with darwintrace.dylib inserted).
Fix a C standard violation (only happening with show process compilation option set, which we don't use in DP).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwintracelib1.0/darwintrace.c

    r18667 r18671  
    11/*
    22 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
    3  * $Id: darwintrace.c,v 1.11 2006/07/20 13:35:24 pguyot Exp $
     3 * $Id: darwintrace.c,v 1.12 2006/07/22 03:08:58 pguyot Exp $
    44 *
    55 * @APPLE_BSD_LICENSE_HEADER_START@
     
    130130#if DARWINTRACE_SHOW_PROCESS
    131131        if (__darwintrace_pid == -1) {
     132                char** progname = _NSGetProgname();
    132133                __darwintrace_pid = getpid();
    133                 char** progname = _NSGetProgname();
    134134                if (progname && *progname) {
    135135                        strcpy(__darwintrace_progname, *progname);
     
    190190                procname ? procname : __darwintrace_progname, __darwintrace_pid,
    191191#endif
    192                 op, path );
     192                op, somepath );
    193193
    194194        write(__darwintrace_fd, logbuffer, size);
     
    267267                                __darwintrace_setup();
    268268                                if (__darwintrace_fd >= 0) {
     269                                    dprintf("darwintrace: original open path is %s\n", path);
    269270                                        log_op("open", NULL, path, result);
    270271                                }
     
    273274                                __darwintrace_setup();
    274275                                if (__darwintrace_fd >= 0) {
     276                                    dprintf("darwintrace: original create path is %s\n", path);
    275277                                        log_op("create", NULL, path, result);
    276278                                }
     
    376378        }
    377379       
    378         saved_fd = __darwintrace_fd;
    379         __darwintrace_fd = -2;
    380 #if DARWINTRACE_SHOW_PROCESS
    381         saved_pid = __darwintrace_pid;
    382         __darwintrace_pid = -1;
    383 #endif
    384        
    385380        result = execve(path, argv, envp);
    386         /* execve failed and the file wasn't closed. keep the reference */
    387         __darwintrace_fd = saved_fd;
    388 #if DARWINTRACE_SHOW_PROCESS
    389         __darwintrace_pid = saved_pid;
    390 #endif
    391 
    392381        return result;
    393382#undef close
Note: See TracChangeset for help on using the changeset viewer.