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-16 18:36:44 +0200 |
commit | f333387748898f9a896b771686a2b192c258f22d (patch) | |
tree | 9b3bfe86525d653c6723f3eaebff03eeeadd35e6 /src/osmo-bts-sysmo/eeprom.c | |
parent | 95c6eed436ab7b0370ac1a4942b10926d3e256ab (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).
Diffstat (limited to 'src/osmo-bts-sysmo/eeprom.c')
-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; } |