Commit 30be512f authored by Jon Lech Johansen's avatar Jon Lech Johansen

* drms.c: fopen in binary mode. Convenience fix for those that use the DRMS

            code outside of VLC and don't set _fmode to _O_BINARY.
parent 65be8db8
...@@ -1655,7 +1655,7 @@ static int WriteUserKey( void *_p_drms, uint32_t *p_user_key ) ...@@ -1655,7 +1655,7 @@ static int WriteUserKey( void *_p_drms, uint32_t *p_user_key )
snprintf( psz_path, PATH_MAX - 1, "%s/" DRMS_DIRNAME "/%08X.%03d", snprintf( psz_path, PATH_MAX - 1, "%s/" DRMS_DIRNAME "/%08X.%03d",
p_drms->psz_homedir, p_drms->i_user, p_drms->i_key ); p_drms->psz_homedir, p_drms->i_user, p_drms->i_key );
file = fopen( psz_path, "w" ); file = fopen( psz_path, "wb" );
if( file != NULL ) if( file != NULL )
{ {
i_ret = fwrite( p_user_key, sizeof(uint32_t), i_ret = fwrite( p_user_key, sizeof(uint32_t),
...@@ -1683,7 +1683,7 @@ static int ReadUserKey( void *_p_drms, uint32_t *p_user_key ) ...@@ -1683,7 +1683,7 @@ static int ReadUserKey( void *_p_drms, uint32_t *p_user_key )
"%s/" DRMS_DIRNAME "/%08X.%03d", p_drms->psz_homedir, "%s/" DRMS_DIRNAME "/%08X.%03d", p_drms->psz_homedir,
p_drms->i_user, p_drms->i_key ); p_drms->i_user, p_drms->i_key );
file = fopen( psz_path, "r" ); file = fopen( psz_path, "rb" );
if( file != NULL ) if( file != NULL )
{ {
i_ret = fread( p_user_key, sizeof(uint32_t), i_ret = fread( p_user_key, sizeof(uint32_t),
...@@ -1902,7 +1902,7 @@ static int GetSCIData( char *psz_ipod, uint32_t **pp_sci, ...@@ -1902,7 +1902,7 @@ static int GetSCIData( char *psz_ipod, uint32_t **pp_sci,
return -1; return -1;
} }
file = fopen( psz_path, "r" ); file = fopen( psz_path, "rb" );
if( file != NULL ) if( file != NULL )
{ {
struct stat st; struct stat st;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment