Changeset 38526
- Timestamp:
- Jun 24, 2015, 6:55:47 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150616/Ohana/src/libohana/src
- Files:
-
- 4 edited
-
config.c (modified) (3 diffs)
-
findexec.c (modified) (4 diffs)
-
glockfile.c (modified) (2 diffs)
-
time.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150616/Ohana/src/libohana/src/config.c
r38498 r38526 91 91 uid = getuid(); 92 92 gid = getgid(); 93 ALLOCATE (find, char, strlen(progname) + 32); 93 94 int Nchar = strlen(progname) + 32; 95 ALLOCATE (find, char, Nchar); 94 96 95 97 /* look for progname.rc */ 96 s printf (find, "%s.rc", progname);98 snprintf (find, Nchar, "%s.rc", progname); 97 99 status = stat (find, &filestat); 98 100 if (status == 0) { … … 125 127 if (home == (char *) NULL) { return ((char *) NULL); } 126 128 ALLOCATE (find, char, 1024); 127 s printf (find, "%s/.%src", home, progname);129 snprintf (find, 1024, "%s/.%src", home, progname); 128 130 status = stat (find, &filestat); 129 131 if (status == 0) { … … 275 277 va_start (argp, Nentry); 276 278 277 ALLOCATE (tfield, char, strlen (field) + 3); 278 sprintf (tfield, "\n%s", field); 279 int Nchar = strlen (field) + 16; 280 ALLOCATE (tfield, char, Nchar); 281 snprintf (tfield, Nchar, "\n%s", field); 279 282 280 283 /* we search for Nentry matching fields, -
branches/eam_branches/ipp-20150616/Ohana/src/libohana/src/findexec.c
r38062 r38526 113 113 /* check permission to write to backup file */ 114 114 if (BACKUP) { 115 ALLOCATE (filename, char, strlen(basefile) + 2); 116 sprintf (filename, "%s~", basefile); 115 int Nchar = strlen(basefile) + 16; 116 ALLOCATE (filename, char, Nchar); 117 snprintf (filename, Nchar, "%s~", basefile); 117 118 status = stat (filename, &filestat); 118 119 if (status == 0) { /* file exists, are permissions OK? */ … … 289 290 e = strchr (c, ':'); 290 291 } 291 s printf (name, "%s/%s", path, argv[0]);292 snprintf (name, 1024, "%s/%s", path, argv[0]); 292 293 status = check_file_exec (name); 293 294 … … 374 375 int status, cmode; 375 376 struct stat filestat; 376 char line[ 256];377 char line[1024]; 377 378 378 379 status = stat (filename, &filestat); 379 380 if (status == 0) { /* file exists, make backup copy */ 380 s printf (line, "cp %s %s~", filename, filename);381 snprintf (line, 1024, "cp %s %s~", filename, filename); 381 382 status = system (line); 382 383 if (status) { … … 385 386 } 386 387 cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 387 s printf (line, "%s~", filename);388 snprintf (line, 1024, "%s~", filename); 388 389 chmod (line, cmode); 389 390 } -
branches/eam_branches/ipp-20150616/Ohana/src/libohana/src/glockfile.c
r37807 r38526 152 152 path = pathname (filename); 153 153 file = filebasename (filename); 154 ALLOCATE (lockname, char, strlen (path) + strlen (file) + 10); 155 sprintf (lockname, "%s/.%s.lck", path, file); 154 int Nchar = strlen (path) + strlen (file) + 16; 155 ALLOCATE (lockname, char, Nchar); 156 snprintf (lockname, Nchar, "%s/.%s.lck", path, file); 156 157 157 158 status = stat (lockname, &filestat); … … 261 262 path = pathname (filename); 262 263 file = filebasename (filename); 263 ALLOCATE (lockname, char, strlen (path) + strlen (file) + 10); 264 sprintf (lockname, "%s/.%s.lck", path, file); 264 int Nchar = strlen (path) + strlen (file) + 16; 265 ALLOCATE (lockname, char, Nchar); 266 snprintf (lockname, Nchar, "%s/.%s.lck", path, file); 265 267 266 268 /* check for lockfile existance */ -
branches/eam_branches/ipp-20150616/Ohana/src/libohana/src/time.c
r34088 r38526 141 141 ALLOCATE (tmpline, char, 64); 142 142 gmt = gmtime (&tsec); 143 s printf (tmpline, "%04d/%02d/%02d,%s", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, &line[6]);143 snprintf (tmpline, 64, "%04d/%02d/%02d,%s", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, &line[6]); 144 144 *second = ohana_date_to_sec (tmpline); 145 145 free (tmpline); … … 251 251 ALLOCATE (line, char, 64); 252 252 gmt = gmtime (&second); 253 s printf (line, "%04d/%02d/%02d,%02d:%02d:%02d", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec);253 snprintf (line, 64, "%04d/%02d/%02d,%02d:%02d:%02d", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec); 254 254 return (line); 255 255
Note:
See TracChangeset
for help on using the changeset viewer.
