|
|
| version 1.106, 2002/03/27 15:30:36 | version 1.108.2.1, 2002/06/10 09:24:08 |
|---|---|
| Line 151 bool file_read(Pool& pool, const String& | Line 151 bool file_read(Pool& pool, const String& |
| } | } |
| #ifdef NO_FOREIGN_GROUP_FILES | #ifdef NO_FOREIGN_GROUP_FILES |
| if(finfo.st_gid/*foreign?*/!=getegid()) { | if(finfo.st_gid/*foreign?*/!=getegid()) { |
| Exception e("parser.runtime", 0, | Exception e("parser.runtime", |
| &file_spec, | &file_spec, |
| "parser reading files of foreign group disabled [recompile parser without --disable-foreign-group-files configure option], actual filename '%s'", | "parser reading files of foreign group disabled [recompile parser without --disable-foreign-group-files configure option], actual filename '%s'", |
| fname); | fname); |
| Line 323 static bool entry_readable(const String& | Line 323 static bool entry_readable(const String& |
| const char *fname=file_spec.cstr(String::UL_FILE_SPEC); | const char *fname=file_spec.cstr(String::UL_FILE_SPEC); |
| struct stat finfo; | struct stat finfo; |
| if(access(fname, R_OK)==0 && stat(fname, &finfo)==0) { | if(access(fname, R_OK)==0 && stat(fname, &finfo)==0) { |
| bool is_dir=finfo.st_mode&S_IFDIR != 0; | bool is_dir=(finfo.st_mode&S_IFDIR) != 0; |
| return is_dir==need_dir; | return is_dir==need_dir; |
| } | } |
| return false; | return false; |
| Line 411 char *rsplit(char *string, char delim) { | Line 411 char *rsplit(char *string, char delim) { |
| /// @todo less stupid type detection | /// @todo less stupid type detection |
| char *format(Pool& pool, double value, char *fmt) { | char *format(Pool& pool, double value, char *fmt) { |
| char *result=(char *)pool.malloc(MAX_NUMBER, 4); | char local_buf[MAX_NUMBER]; |
| size_t size; | |
| if(fmt) | if(fmt) |
| if(strpbrk(fmt, "diouxX")) | if(strpbrk(fmt, "diouxX")) |
| if(strpbrk(fmt, "ouxX")) | if(strpbrk(fmt, "ouxX")) |
| snprintf(result, MAX_NUMBER, fmt, (uint)value ); | size=snprintf(local_buf, sizeof(local_buf), fmt, (uint)value); |
| else | else |
| snprintf(result, MAX_NUMBER, fmt, (int)value ); | size=snprintf(local_buf, sizeof(local_buf), fmt, (int)value); |
| else | else |
| snprintf(result, MAX_NUMBER, fmt, value); | size=snprintf(local_buf, sizeof(local_buf), fmt, value); |
| else | else |
| snprintf(result, MAX_NUMBER, "%d", (int)value); | size=snprintf(local_buf, sizeof(local_buf), "%d", (int)value); |
| return result; | char *pool_buf=(char *)pool.malloc(size+1, 4); |
| memcpy(pool_buf, local_buf, size+1); | |
| return pool_buf; | |
| } | } |
| size_t stdout_write(const void *buf, size_t size) { | size_t stdout_write(const void *buf, size_t size) { |