~ubuntu-branches/ubuntu/utopic/foremost/utopic-proposed

« back to all changes in this revision

Viewing changes to state.c

  • Committer: Bazaar Package Importer
  • Author(s): Gürkan Sengün
  • Date: 2008-05-20 09:31:54 UTC
  • mfrom: (1.2.2 upstream) (2.1.6 hardy)
  • Revision ID: james.westby@ubuntu.com-20080520093154-qalsy1z1slax40z0
Tags: 1.5.4-1
* New upstream version.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
int set_output_directory(f_state *s, char *fn)
88
88
{
89
89
        char    temp[PATH_MAX];
90
 
 
 
90
  int   fullpathlen=0;
91
91
        /* We don't error check here as it's quite possible that the
92
92
     output directory doesn't exist yet. If it doesn't, realpath
93
93
     resolves the path correctly, but still returns NULL. */
 
94
  //strncpy(s->output_directory,fn,PATH_MAX);
 
95
  
94
96
        realpath(fn, temp);
 
97
        fullpathlen=strlen(temp);
95
98
 
96
 
        /* RBF - Does this create a memory leak? What happens to the old value? */
97
 
        s->output_directory = strdup(temp);
 
99
        if(fullpathlen!=0)
 
100
        {
 
101
                s->output_directory = strdup(temp);
 
102
        }
 
103
        else
 
104
        {
 
105
                /*Realpath failed just use cwd*/
 
106
                s->output_directory = strdup(fn);
 
107
        }
98
108
        return FALSE;
99
109
}
100
110
 
177
187
        va_list argp;
178
188
        va_start(argp, format);
179
189
 
180
 
        if (get_mode(s, mode_verbose))
 
190
        if (get_mode(s, mode_verbose)) {
181
191
                print_message(s, format, argp);
 
192
                va_end(argp);
 
193
                va_start(argp, format);
 
194
        }
182
195
 
183
196
        vfprintf(s->audit_file, format, argp);
184
197
        va_end(argp);
259
272
void init_all(f_state *state)
260
273
{
261
274
        int index = 0;
262
 
        init_builtin(state, JPEG, "jpg", "\xff\xd8\xff", "\xff\xd9", 3, 2, 2 * MEGABYTE, TRUE);
 
275
        init_builtin(state, JPEG, "jpg", "\xff\xd8\xff", "\xff\xd9", 3, 2, 20 * MEGABYTE, TRUE);
263
276
        index = init_builtin(state, GIF, "gif", "\x47\x49\x46\x38", "\x00\x3b", 4, 2, MEGABYTE, TRUE);
264
277
        add_marker(state, index, "\x00\x00\x3b", 3);
265
278
        init_builtin(state, BMP, "bmp", "BM", NULL, 2, 0, 2 * MEGABYTE, TRUE);
339
352
        if (strcmp(ft, "jpg") == 0 || strcmp(ft, "jpeg") == 0)
340
353
                {
341
354
                if (max_file_size == 0)
342
 
                        max_file_size = 2 * MEGABYTE;
 
355
                        max_file_size = 20 * MEGABYTE;
343
356
                init_builtin(s, JPEG, "jpg", "\xff\xd8\xff", "\xff\xd9", 3, 2, max_file_size, TRUE);
344
357
                }
345
358
        else if (strcmp(ft, "gif") == 0)