Hi all,
I'm using eet for the highscore support in elitaire, but eet crashes
while writing into a file that is in a directory, for that the user
hasn't got write permission, altough he has write permission for the
file itself.
To reproduce this:
- first compile the attached test app and then make a directory called tmp
- execute the the test app once or twice (or oftener)
- chmod 555 tmp
- then execute it again and it will crash
Attached you will find the test app and the backtrace
regards,
peter
Program received signal SIGBUS, Bus error.
0xb7bbfdb8 in strcmp () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7bbfdb8 in strcmp () from /lib/tls/libc.so.6
#1 0xb7ed6dc3 in eet_string_match (s1=0xb7efb020 "", s2=0x8048bf6 "blah")
at eet_lib.c:263
#2 0xb7ed8a17 in eet_write (ef=0x804a028, name=0x8048bf6 "blah",
data=0xbfc0da70, size=1024, compress=1) at eet_lib.c:1053
#3 0x08048a01 in main (argc=1, argv=0xbfc0df14) at test.c:37
(gdb) fr 3
#3 0x08048a01 in main (argc=1, argv=0xbfc0df14) at test.c:37
37 if (!eet_write(ef, "blah", buf, 1024, 1))
(gdb) l
32 else
33 ef = eet_open("tmp/foo.eet", EET_FILE_MODE_WRITE);
34
35 if (!ef) return -1;
36
37 if (!eet_write(ef, "blah", buf, 1024, 1))
38 fprintf(stderr, "Error writing data!\n");
39 eet_close(ef);
40
41 ef = eet_open("tmp/foo.eet", EET_FILE_MODE_READ);
(gdb) fr 2
#2 0xb7ed8a17 in eet_write (ef=0x804a028, name=0x8048bf6 "blah",
data=0xbfc0da70, size=1024, compress=1) at eet_lib.c:1053
1053 if (eet_string_match(efn->name, name))
(gdb) list
1048 if (ef->mode == EET_FILE_MODE_READ_WRITE)
1049 {
1050 for (efn = ef->header->directory->nodes[hash]; efn; efn =
efn->next)
1051 {
1052 /* if it matches */
1053 if (eet_string_match(efn->name, name))
1054 {
1055 free(efn->data);
1056 efn->compression = !!compress;
1057 efn->size = data_size;
(gdb) fr 1
#1 0xb7ed6dc3 in eet_string_match (s1=0xb7efb020 "", s2=0x8048bf6 "blah")
at eet_lib.c:263
263 return (!strcmp(s1, s2));
(gdb) list
258 static int
259 eet_string_match(const char *s1, const char *s2)
260 {
261 /* both null- no match */
262 if ((!s1) || (!s2)) return 0;
263 return (!strcmp(s1, s2));
264 }
265
266 /* flush out writes to an eet file */
267 static Eet_Error
(gdb) p s1
$1 = 0xb7efb020 ""
(gdb) p *s1
$2 = 0 '\0'
(gdb) p s2
$3 = 0x8048bf6 "blah"
#include <Ecore_File.h>
#include <Eet.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
Eet_File *ef;
char buf[1024], *ret;
int size, num, i;
eet_init();
ecore_file_init();
strcpy(buf, "Here is a string of data to save!");
if (ecore_file_exists("tmp/foo.eet")) {
ef = eet_open("tmp/foo.eet", EET_FILE_MODE_READ);
if (ef) {
ret = eet_read(ef, "blah", &size);
if (ret) {
printf("Data read (%i bytes):\n%s\n", size,
ret);
free(ret);
}
eet_close(ef);
}
strcpy(buf, "Here is a string of data to save, second run!");
ef = eet_open("tmp/foo.eet", EET_FILE_MODE_READ_WRITE);
}
else
ef = eet_open("tmp/foo.eet", EET_FILE_MODE_WRITE);
if (!ef) return -1;
if (!eet_write(ef, "blah", buf, 1024, 1))
fprintf(stderr, "Error writing data!\n");
eet_close(ef);
ef = eet_open("tmp/foo.eet", EET_FILE_MODE_READ);
if (!ef) return -1;
ret = eet_read(ef, "blah", &size);
if (ret) {
printf("Data read (%i bytes):\n%s\n", size, ret);
free(ret);
}
eet_close(ef);
return 0;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel