{
int fd;
- fd = open(filename, flags);
+ fd = open(filename, flags, 0600);
return fd;
}
return buffer;
}
+/* Returns files size. Returns 0 on error. */
+
+uint64 silc_file_size(const char *filename)
+{
+ int ret;
+ struct stat stats;
+
+ ret = lstat(filename, &stats);
+ if (ret < 0)
+ return 0;
+
+ return (uint64)stats.st_size;
+}
+
/* Gets line from a buffer. Stops reading when a newline or EOF occurs.
This doesn't remove the newline sign from the destination buffer. The
argument begin is returned and should be passed again for the function. */