Fix compile warnings
Todo: error checking for DTSC::File::getHeader
This commit is contained in:
parent
c35e1bbef6
commit
42875cd544
2 changed files with 11 additions and 2 deletions
|
@ -342,5 +342,9 @@ void Util::Daemonize(){
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
fprintf(stderr, "Going into background mode...\n");
|
fprintf(stderr, "Going into background mode...\n");
|
||||||
#endif
|
#endif
|
||||||
daemon(1, 0);
|
if (daemon(1, 0) < 0) {
|
||||||
|
#if DEBUG >= 1
|
||||||
|
fprintf(stderr, "Failed to daemonize: %s\n", strerror(errno));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,12 @@ DTSC::File::File(std::string filename, bool create){
|
||||||
std::string & DTSC::File::getHeader(){
|
std::string & DTSC::File::getHeader(){
|
||||||
fseek(F, 8, SEEK_SET);
|
fseek(F, 8, SEEK_SET);
|
||||||
strbuffer.resize(headerSize);
|
strbuffer.resize(headerSize);
|
||||||
fread((void*)strbuffer.c_str(), headerSize, 1, F);
|
if (fread((void*)strbuffer.c_str(), headerSize, 1, F) != headerSize){
|
||||||
|
/// \todo check seek as well and do something more sensible...
|
||||||
|
#if DEBUG >= 10
|
||||||
|
fprintf(stderr, "Panic! Invalid DTSC File header\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
fseek(F, 8+headerSize, SEEK_SET);
|
fseek(F, 8+headerSize, SEEK_SET);
|
||||||
return strbuffer;
|
return strbuffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue