Update of /cvsroot/alsa/alsa-kernel
In directory sc8-pr-cvs1:/tmp/cvs-serv10576

Modified Files:
        sound_firmware.c 
Log Message:
Petr Vandrovec <[EMAIL PROTECTED]>
Avoid errno problems.


Index: sound_firmware.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/sound_firmware.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sound_firmware.c    6 Jan 2003 09:10:12 -0000       1.2
+++ sound_firmware.c    14 Jan 2003 17:00:31 -0000      1.3
@@ -9,39 +9,40 @@
 
 static int do_mod_firmware_load(const char *fn, char **fp)
 {
-       int fd;
+       struct file* filp;
        long l;
        char *dp;
+       loff_t pos;
 
-       fd = open(fn, 0, 0);
-       if (fd == -1)
+       filp = filp_open(fn, 0, 0);
+       if (IS_ERR(filp))
        {
                printk(KERN_INFO "Unable to load '%s'.\n", fn);
                return 0;
        }
-       l = lseek(fd, 0L, 2);
+       l = filp->f_dentry->d_inode->i_size;
        if (l <= 0 || l > 131072)
        {
                printk(KERN_INFO "Invalid firmware '%s'\n", fn);
-               sys_close(fd);
+               filp_close(filp, current->files);
                return 0;
        }
-       lseek(fd, 0L, 0);
        dp = vmalloc(l);
        if (dp == NULL)
        {
                printk(KERN_INFO "Out of memory loading '%s'.\n", fn);
-               sys_close(fd);
+               filp_close(filp, current->files);
                return 0;
        }
-       if (read(fd, dp, l) != l)
+       pos = 0;
+       if (vfs_read(filp, dp, l, &pos) != l)
        {
                printk(KERN_INFO "Failed to read '%s'.\n", fn);
                vfree(dp);
-               sys_close(fd);
+               filp_close(filp, current->files);
                return 0;
        }
-       close(fd);
+       filp_close(filp, current->files);
        *fp = dp;
        return (int) l;
 }



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to