inifile.cc (2665:a124942bacb8) inifile.cc (5202:ff56fa8c2091)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 97 unchanged lines hidden (view full) ---

106
107 if (pid == 0) {
108 char filename[FILENAME_MAX];
109 string::size_type i = file.copy(filename, sizeof(filename) - 1);
110 filename[i] = '\0';
111
112 int arg_count = cppArgs.size();
113
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 97 unchanged lines hidden (view full) ---

106
107 if (pid == 0) {
108 char filename[FILENAME_MAX];
109 string::size_type i = file.copy(filename, sizeof(filename) - 1);
110 filename[i] = '\0';
111
112 int arg_count = cppArgs.size();
113
114 char **args = new char *[arg_count + 20];
114 const char **args = new const char *[arg_count + 20];
115
116 int nextArg = 0;
117 args[nextArg++] = "g++";
118 args[nextArg++] = "-E";
119 args[nextArg++] = "-P";
120 args[nextArg++] = "-nostdinc";
121 args[nextArg++] = "-nostdinc++";
122 args[nextArg++] = "-x";

--- 8 unchanged lines hidden (view full) ---

131
132 args[nextArg++] = filename;
133 args[nextArg++] = NULL;
134
135 close(STDOUT_FILENO);
136 if (dup2(tmp_fd, STDOUT_FILENO) == -1)
137 exit(1);
138
115
116 int nextArg = 0;
117 args[nextArg++] = "g++";
118 args[nextArg++] = "-E";
119 args[nextArg++] = "-P";
120 args[nextArg++] = "-nostdinc";
121 args[nextArg++] = "-nostdinc++";
122 args[nextArg++] = "-x";

--- 8 unchanged lines hidden (view full) ---

131
132 args[nextArg++] = filename;
133 args[nextArg++] = NULL;
134
135 close(STDOUT_FILENO);
136 if (dup2(tmp_fd, STDOUT_FILENO) == -1)
137 exit(1);
138
139 execvp("g++", args);
139 // execvp signature is intentionally broken wrt const-ness for
140 // backwards compatibility... see man page
141 execvp("g++", const_cast<char * const *>(args));
140
141 exit(0);
142 }
143
144 int retval;
145 waitpid(pid, &retval, 0);
146
147 delete [] dir_arg;

--- 289 unchanged lines hidden ---
142
143 exit(0);
144 }
145
146 int retval;
147 waitpid(pid, &retval, 0);
148
149 delete [] dir_arg;

--- 289 unchanged lines hidden ---