summaryrefslogtreecommitdiffstats
path: root/src/simfs.c
diff options
context:
space:
mode:
authorJeevaka Badrappan <jeevaka.badrappan@elektrobit.com>2010-12-06 10:39:17 -0800
committerDenis Kenzior <denkenz@gmail.com>2010-12-12 04:41:27 -0600
commitd06c03f0999460e4d9576d95e406738eb6b33102 (patch)
tree6de330adcf0c0278f9818be9242efa00b98816be /src/simfs.c
parenta8c94c044f045d605130b76bb5b42b7d49376839 (diff)
downloadofono-d06c03f0999460e4d9576d95e406738eb6b33102.tar.bz2
simfs: Add unknown sim phase check
Diffstat (limited to 'src/simfs.c')
-rw-r--r--src/simfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/simfs.c b/src/simfs.c
index 8e52f7b2..617af149 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -554,7 +554,8 @@ static gboolean sim_fs_op_check_cached(struct sim_fs *fs)
enum ofono_sim_file_structure structure;
int record_length;
- if (imsi == NULL || op->info_only == TRUE)
+ if (imsi == NULL || phase == OFONO_SIM_PHASE_UNKNOWN ||
+ op->info_only == TRUE)
return FALSE;
path = g_strdup_printf(SIM_CACHE_PATH, imsi, phase, op->id);
@@ -836,6 +837,9 @@ char *sim_fs_get_cached_image(struct sim_fs *fs, int id)
return NULL;
phase = ofono_sim_get_phase(fs->sim);
+ if (phase == OFONO_SIM_PHASE_UNKNOWN)
+ return NULL;
+
path = g_strdup_printf(SIM_IMAGE_CACHE_PATH, imsi, phase, id);
TFR(stat(path, &st_buf));
@@ -907,6 +911,9 @@ void sim_fs_check_version(struct sim_fs *fs)
int len;
char *path;
+ if (imsi == NULL || phase == OFONO_SIM_PHASE_UNKNOWN)
+ return;
+
if (read_file(&version, 1, SIM_CACHE_VERSION, imsi, phase) == 1)
if (version == SIM_FS_VERSION)
return;