Does anything look wrong in this function?

Richard Sharpe realrichardsharpe at gmail.com
Thu Mar 24 02:23:21 UTC 2016


Saw this while working on my DOS ATTRIBUTES stuff:

NTSTATUS set_create_timespec_ea(connection_struct *conn,
                                const struct smb_filename *psmb_fname,
                                struct timespec create_time)
{
        struct smb_filename *smb_fname;
        uint32_t dosmode;
        int ret;

        if (!lp_store_dos_attributes(SNUM(conn))) {
                return NT_STATUS_OK;
        }

        smb_fname = synthetic_smb_fname(talloc_tos(), psmb_fname->base_name,
                                        NULL, &psmb_fname->st);

        if (smb_fname == NULL) {
                return NT_STATUS_NO_MEMORY;
        }

        dosmode = dos_mode(conn, smb_fname);

        smb_fname->st.st_ex_btime = create_time;

        ret = file_set_dosmode(conn, smb_fname, dosmode, NULL, false);
        if (ret == -1) {
                map_nt_error_from_unix(errno);
        }

        DEBUG(10,("set_create_timespec_ea: wrote create time EA for file %s\n",
                smb_fname_str_dbg(smb_fname)));

        return NT_STATUS_OK;
}

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)



More information about the samba-technical mailing list