smbd: Fix a typo in a few places
[samba.git] / source3 / modules / vfs_prealloc.c
index 19b142e877b3bf436c922d600bf8996104b95645..51e9ad0d8fb41cdc2df9858f0e0d6892a13c7fd3 100644 (file)
@@ -110,15 +110,14 @@ static int prealloc_openat(struct vfs_handle_struct* handle,
                           const struct files_struct *dirfsp,
                           const struct smb_filename *smb_fname,
                           files_struct *fsp,
-                          int flags,
-                          mode_t mode)
+                          const struct vfs_open_how *how)
 {
        int fd;
        off_t size = 0;
        const char * dot;
        char fext[10];
 
-       if (!(flags & (O_CREAT|O_TRUNC))) {
+       if (!(how->flags & (O_CREAT|O_TRUNC))) {
                /* Caller is not intending to rewrite the file. Let's not mess
                 * with the allocation in this case.
                 */
@@ -129,8 +128,10 @@ static int prealloc_openat(struct vfs_handle_struct* handle,
        dot = strrchr(smb_fname->base_name, '.');
        if (dot && *++dot) {
                if (strlen(dot) < sizeof(fext)) {
+                       bool ok;
                        strncpy(fext, dot, sizeof(fext));
-                       if (!strnorm(fext, CASE_LOWER)) {
+                       ok = strlower_m(fext);
+                       if (!ok);
                                goto normal_open;
                        }
                }
@@ -153,16 +154,16 @@ static int prealloc_openat(struct vfs_handle_struct* handle,
                goto normal_open;
        }
 
-       fd = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+       fd = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
        if (fd < 0) {
                return fd;
        }
 
-       /* Prellocate only if the file is being created or replaced. Note that
+       /* Preallocate only if the file is being created or replaced. Note that
         * Samba won't ever pass down O_TRUNC, which is why we have to handle
         * truncate calls specially.
         */
-       if ((flags & O_CREAT) || (flags & O_TRUNC)) {
+       if ((how->flags & O_CREAT) || (how->flags & O_TRUNC)) {
                off_t * psize;
 
                psize = VFS_ADD_FSP_EXTENSION(handle, fsp, off_t, NULL);
@@ -189,7 +190,7 @@ normal_open:
         */
        DEBUG(module_debug, ("%s: skipping preallocation for %s\n",
                MODULE, smb_fname_str_dbg(smb_fname)));
-       return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+       return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
 }
 
 static int prealloc_ftruncate(vfs_handle_struct * handle,