diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-14 08:05:15 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-14 08:05:15 +0200 |
commit | 4afc52a16e8132494fe324db2447d42190cbb332 (patch) | |
tree | eda3bfd79e7d5f3fed54ddd73b9c338335e11077 | |
parent | 2d5575c37ef1d585bb063c11df87a5f1c9c2b6d0 (diff) |
eeprom: After eeprom_write g_file could point to a closed file
Calling eeprom_write would either re-use g_file or newly open the
file and set g_file but it will close the file as well. This will
lead to other code using fseek/fread on a closed file.
On top of that the general rule for the eeprom code now is that
read and write may not be mixed (due caching and other bits).
-rw-r--r-- | src/osmo-bts-sysmo/eeprom.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/eeprom.c b/src/osmo-bts-sysmo/eeprom.c index f0fdaabb..ef66b399 100644 --- a/src/osmo-bts-sysmo/eeprom.c +++ b/src/osmo-bts-sysmo/eeprom.c @@ -1381,6 +1381,7 @@ static int eeprom_write( int addr, int size, const char *pBuff ) fseek( f, addr, SEEK_SET ); n = fwrite( pBuff, 1, size, f ); fclose( f ); + g_file = NULL; return n; } |