check filesystem operations
This commit is contained in:
parent
2b01ed373c
commit
37542da610
|
@ -962,6 +962,7 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
FILE *f;
|
FILE *f;
|
||||||
unsigned char *fdata;
|
unsigned char *fdata;
|
||||||
int fsize;
|
int fsize;
|
||||||
|
int res;
|
||||||
|
|
||||||
evas_object_del(ppopup);
|
evas_object_del(ppopup);
|
||||||
popup = _processing(ephoto, _("Upload Image"),
|
popup = _processing(ephoto, _("Upload Image"),
|
||||||
|
@ -969,12 +970,17 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
evas_object_show(popup);
|
evas_object_show(popup);
|
||||||
|
|
||||||
f = fopen(entry->path, "rb");
|
f = fopen(entry->path, "rb");
|
||||||
fseek(f, 0, SEEK_END);
|
if (!f) CRIT("unable to open '%s': %s", entry->path, strerror(errno));
|
||||||
|
res = fseek(f, 0, SEEK_END);
|
||||||
|
if (!res) CRIT("fseek() failed on file '%s': %s", entry->path, strerror(errno));
|
||||||
fsize = ftell(f);
|
fsize = ftell(f);
|
||||||
|
if (fsize == -1) CRIT("ftell() failed on file '%s': %s", entry->path, strerror(errno));
|
||||||
rewind(f);
|
rewind(f);
|
||||||
fdata = malloc(fsize);
|
fdata = malloc(fsize);
|
||||||
fread(fdata, fsize, 1, f);
|
res = fread(fdata, fsize, 1, f);
|
||||||
fclose(f);
|
if (res < 1) CRIT("fread() failed on file '%s': %s", entry->path, strerror(errno));
|
||||||
|
res = fclose(f);
|
||||||
|
if (!res) CRIT("fclose() failed on file '%s': %s", entry->path, strerror(errno));
|
||||||
|
|
||||||
snprintf(buf, PATH_MAX, "image=%s", fdata);
|
snprintf(buf, PATH_MAX, "image=%s", fdata);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue