~ubuntu-branches/ubuntu/vivid/whoopsie/vivid-proposed

« back to all changes in this revision

Viewing changes to src/utils.c

  • Committer: Package Import Robot
  • Author(s): Evan Dandrea
  • Date: 2012-06-18 09:32:46 UTC
  • Revision ID: package-import@ubuntu.com-20120618093246-djrgv8yn3lfrfocx
Tags: 0.2.1
Provide a libwhoopsie library. This allows the control center panel
via activity-log-manager to provide a 'Show Previous Reports'
button.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
void
30
30
init_response_string (struct response_string* resp)
31
31
{
 
32
    g_return_if_fail (resp);
 
33
 
32
34
    resp->length = 0;
33
35
    resp->p = g_malloc (1);
34
36
    resp->p[0] = '\0';
37
39
void
38
40
grow_response_string (struct response_string* resp, char* str, size_t length)
39
41
{
40
 
    size_t new_length = resp->length + length;
 
42
    size_t new_length;
 
43
 
 
44
    g_return_if_fail (resp);
 
45
    g_return_if_fail (str);
 
46
 
 
47
    new_length = resp->length + length;
41
48
    resp->p = g_realloc (resp->p, new_length + 1);
42
49
    memcpy (resp->p + resp->length, str, length);
43
50
    resp->p[new_length] = '\0';
96
103
    struct stat upload_stat;
97
104
    struct stat crash_stat;
98
105
 
 
106
    g_return_val_if_fail (crash_file, FALSE);
 
107
 
99
108
    if (stat (crash_file, &crash_stat) < 0)
100
109
        /* .crash doesn't exist; don't process. */
101
110
        return TRUE;
112
121
    free (upload_file);
113
122
    
114
123
    uploaded_file = change_file_extension (crash_file, ".uploaded");
 
124
    if (!uploaded_file)
 
125
        /* Bogus crash file; don't process. */
 
126
        return TRUE;
 
127
 
115
128
    if (stat (uploaded_file, &uploaded_stat) < 0) {
116
129
        /* .uploaded doesn't exist. */
117
130
        free (uploaded_file);
131
144
    char* uploaded_file = NULL;
132
145
    int fd;
133
146
 
 
147
    g_return_val_if_fail (crash_file, FALSE);
 
148
 
134
149
    uploaded_file = change_file_extension (crash_file, ".uploaded");
135
150
    if (!uploaded_file)
136
151
        return FALSE;