Changeset 38553 for trunk/Ohana/src/libohana/src/config.c
- Timestamp:
- Jun 25, 2015, 10:41:05 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libohana/src/config.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/src/config.c
r38459 r38553 7 7 static char **DefineVariable; 8 8 static char **DefineValue; 9 10 void FreeConfigFile (void) { 11 int i; 12 for (i = 0; i < NDefineVariable; i++) { 13 free (DefineVariable[i]); 14 free (DefineValue[i]); 15 } 16 free (DefineVariable); 17 free (DefineValue); 18 free (ConfigVariable); 19 } 9 20 10 21 char *SelectConfigFile (int *argc, char **argv, char *progname) { … … 80 91 uid = getuid(); 81 92 gid = getgid(); 82 ALLOCATE (find, char, strlen(progname) + 32); 93 94 int Nchar = strlen(progname) + 32; 95 ALLOCATE (find, char, Nchar); 83 96 84 97 /* look for progname.rc */ 85 s printf (find, "%s.rc", progname);98 snprintf (find, Nchar, "%s.rc", progname); 86 99 status = stat (find, &filestat); 87 100 if (status == 0) { … … 114 127 if (home == (char *) NULL) { return ((char *) NULL); } 115 128 ALLOCATE (find, char, 1024); 116 s printf (find, "%s/.%src", home, progname);129 snprintf (find, 1024, "%s/.%src", home, progname); 117 130 status = stat (find, &filestat); 118 131 if (status == 0) { … … 264 277 va_start (argp, Nentry); 265 278 266 ALLOCATE (tfield, char, strlen (field) + 3); 267 sprintf (tfield, "\n%s", field); 279 int Nchar = strlen (field) + 16; 280 ALLOCATE (tfield, char, Nchar); 281 snprintf (tfield, Nchar, "\n%s", field); 268 282 269 283 /* we search for Nentry matching fields,
Note:
See TracChangeset
for help on using the changeset viewer.
