Results 1 to 1 of 1
I can get my open.c code to compile just fine (though not as attached - I un-did some commenting). However, upon restarting, I am given the error:
Code:
PM panic ...
- 06-27-2009 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 41
MORE char* error in Minix - why does this hate me?
I can get my open.c code to compile just fine (though not as attached - I un-did some commenting). However, upon restarting, I am given the error:
This appears to be tied to the char* declaration on line 73. When commented out (along with the rest of the references to char* path, obviously), the code compiles fine and executes appropriately. Even more strange, you notice that I added a trace on line 72. This trace is ONLY displayed when a file contains "lnk." This confirms that no other code is even enters the if statement at line 69 unless the file contains the characters "lnk," and therefore the char* path is not even executed. (Actually, I take that back memory is still being allocated every time the open command is run, so it would be executed, technically). So, there is SOMETHING wrong with my declaration of this variable. I have tried several things, including (but not limited to):Code:PM panic (utility.c): allowed: fstat failed init: sh /etc/rc: unknown error
The list continues. Am I not allocating this string correctly?Code:char* path = (char*)malloc(size * sizeof char) char* path = (char*)malloc(size * sizeof path) char* path = (char*)malloc(1024)
Perhaps a fix would be to declare path with the scanf() if that is possible. That way, it would be like
Here, temp is getting assigned the return value. Can I do the same thing with scanf()? scanf("%s", char* temp)?Code:char* temp = return_of_function
So, there is SOMETHING wrong with my method of allocating this string. Thoughts?


Reply With Quote