comparison src/cdrom/linux/SDL_syscdrom.c @ 247:b0f09f86378d

Fix crash with Linux supermount fstab entries (thanks Erno!)
author Sam Lantinga <slouken@libsdl.org>
date Wed, 05 Dec 2001 23:49:09 +0000
parents ef23a1bf1244
children e8157fcb3114
comparison
equal deleted inserted replaced
246:7c09c9e3b0c7 247:b0f09f86378d
201 201
202 /* Handle "supermount" filesystem mounts */ 202 /* Handle "supermount" filesystem mounts */
203 if ( strcmp(mnt_type, MNTTYPE_SUPER) == 0 ) { 203 if ( strcmp(mnt_type, MNTTYPE_SUPER) == 0 ) {
204 tmp = strstr(mntent->mnt_opts, "fs="); 204 tmp = strstr(mntent->mnt_opts, "fs=");
205 if ( tmp ) { 205 if ( tmp ) {
206 strcpy(mnt_type, tmp+strlen("fs=")); 206 free(mnt_type);
207 tmp = strchr(mnt_type, ','); 207 mnt_type = strdup(tmp + strlen("fs="));
208 if ( tmp ) { 208 if ( mnt_type ) {
209 *tmp = '\0'; 209 tmp = strchr(mnt_type, ',');
210 if ( tmp ) {
211 *tmp = '\0';
212 }
210 } 213 }
211 } 214 }
212 tmp = strstr(mntent->mnt_opts, "dev="); 215 tmp = strstr(mntent->mnt_opts, "dev=");
213 if ( tmp ) { 216 if ( tmp ) {
214 strcpy(mnt_dev, tmp+strlen("dev=")); 217 free(mnt_dev);
215 tmp = strchr(mnt_dev, ','); 218 mnt_dev = strdup(tmp + strlen("dev="));
216 if ( tmp ) { 219 if ( mnt_dev ) {
217 *tmp = '\0'; 220 tmp = strchr(mnt_dev, ',');
221 if ( tmp ) {
222 *tmp = '\0';
223 }
218 } 224 }
219 } 225 }
220 } 226 }
221 if ( strcmp(mnt_type, MNTTYPE_CDROM) == 0 ) { 227 if ( strcmp(mnt_type, MNTTYPE_CDROM) == 0 ) {
222 #ifdef DEBUG_CDROM 228 #ifdef DEBUG_CDROM