ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/common.c
(Generate patch)

Comparing CCSAdmin/common.c (file contents):
Revision 586 by douglas, 2005-11-23T21:16:24-08:00 vs.
Revision 589 by douglas, 2005-11-25T05:49:24-08:00

# Line 6 | Line 6
6  
7   #include "common.h"
8  
9 + #ifdef __sun__
10 + #define getpass getpassphrase
11 + #endif
12 +
13   Shells shells[] = {
14          { "sh", "/bin/sh", "/bin/sh", "/bin/sh", "/usr/bin/sh" },
15          { "csh", "/bin/csh", "/bin/csh", "/bin/csh", "/usr/bin/csh" },
# Line 203 | Line 207 | char *fgetln(FILE * restrict stream, siz
207  
208   int setenv(const char *name, const char *value, int overwrite)
209   {
210 <        char *string = getenv(name);
210 >        char *string_ = getenv(name);
211  
212 <        if (overwrite || !string)
212 >        if (overwrite || !string_)
213          {
214 <                string = string ? realloc(string, strlen(name) + strlen(value) + 2) : malloc(strlen(name) + strlen(value) + 2);
214 >                char *string = malloc(strlen(name) + strlen(value) + 2);
215  
216                  sprintf(string, "%s=%s", name, value);
217  
218 <                return putenv(string);
218 >                int value_ = putenv(string);
219 >
220 >                if (!string_)
221 >                        free(string_);
222 >
223 >                return value_;
224          }
225  
226          return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines