[openib-general] Re: [PATCH] Opensm - osm_db_file.c - windows fixes
Hal Rosenstock
halr at voltaire.com
Thu Feb 9 07:47:33 PST 2006
On Mon, 2006-02-06 at 04:03, Yael Kalka wrote:
> Hi Hal,
>
> The following patch adds some changes in osm_db_file.c to match the
> windows stack.
Thanks. Applied with some commentary difference and error number change.
-- Hal
> Thanks,
> Yael
>
> Signed-off-by: Yael Kalka <yael at mellanox.co.il>
>
> Index: opensm/osm_db_files.c
> ===================================================================
> --- opensm/osm_db_files.c (revision 5307)
> +++ opensm/osm_db_files.c (working copy)
> @@ -172,6 +172,12 @@ osm_db_init(
> if ( p_db_imp->db_dir_name == NULL )
> p_db_imp->db_dir_name = OSM_DEFAULT_CACHE_DIR;
>
> + /* create the directory if it doesn't exist */
> + /* There is difference between creating in windows and in linux */
> +#ifdef __WIN__
> + /* Check if the directory exists. If not - create it. */
> + CreateDirectory(p_db_imp->db_dir_name, NULL);
> +#else /* __WIN__ */
> /* make sure the directory exists */
> if (lstat(p_db_imp->db_dir_name, &dstat))
> {
> @@ -185,6 +191,7 @@ osm_db_init(
> return 1;
> }
> }
> +#endif
>
> p_db->p_log = p_log;
> p_db->p_db_imp = (void*)p_db_imp;
> @@ -466,6 +473,14 @@ osm_db_store(
> fclose(p_file);
>
> /* move the domain file */
> + status = remove(p_domain_imp->file_name);
> + if (status)
> + {
> + osm_log( p_log, OSM_LOG_ERROR,
> + "osm_db_store: ERR 6909: "
> + " Fail to remove file:%s (err:%u)\n",
> + p_domain_imp->file_name, status);
> + }
> status = rename(p_tmp_file_name, p_domain_imp->file_name);
> if (status)
> {
>
More information about the general
mailing list