mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-06-06 11:00:49 +00:00
Don't try to read from /etc/mime.types if it
is not present/readable. Don't process blank lines in mime.types There wasn't an issue seen with this, just cleaning up the code a bit. git-svn-id: http://s3fs.googlecode.com/svn/trunk@245 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
parent
7429227922
commit
4187f03089
|
@ -1,7 +1,7 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(s3fs, 1.15)
|
||||
AC_INIT(s3fs, 1.16)
|
||||
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
|
30
src/s3fs.cpp
30
src/s3fs.cpp
|
@ -1532,19 +1532,25 @@ static void* s3fs_init(struct fuse_conn_info *conn) {
|
|||
pthread_mutex_init(&stat_cache_lock, NULL);
|
||||
//
|
||||
string line;
|
||||
ifstream passwd("/etc/mime.types");
|
||||
while (getline(passwd, line)) {
|
||||
if (line[0]=='#')
|
||||
continue;
|
||||
stringstream tmp(line);
|
||||
string mimeType;
|
||||
tmp >> mimeType;
|
||||
while (tmp) {
|
||||
string ext;
|
||||
tmp >> ext;
|
||||
if (ext.size() == 0)
|
||||
ifstream MT("/etc/mime.types");
|
||||
if (MT.good()) {
|
||||
while (getline(MT, line)) {
|
||||
if (line[0]=='#') {
|
||||
continue;
|
||||
mimeTypes[ext] = mimeType;
|
||||
}
|
||||
if (line.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
stringstream tmp(line);
|
||||
string mimeType;
|
||||
tmp >> mimeType;
|
||||
while (tmp) {
|
||||
string ext;
|
||||
tmp >> ext;
|
||||
if (ext.size() == 0)
|
||||
continue;
|
||||
mimeTypes[ext] = mimeType;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user