Hi Al,
On 16:52 Thu 15 Apr , Al Chu wrote:
> diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
> b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
> index 480a0a2..6cf7d4d 100644
> --- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
> +++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
> @@ -876,9 +876,20 @@ int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char
> *file,
> return -1;
> }
>
> - if (!stat(file, &statbuf)) {
> - IBND_DEBUG("file '%s' already exists\n", file);
> - return -1;
> + if (flags & IBND_CACHE_FABRIC_FLAG_OVERWRITE) {
> + if (!stat(file, &statbuf)) {
> + if (unlink(file) < 0) {
> + IBND_DEBUG("error removing '%s': %s\n",
> + file, strerror(errno));
> + return -1;
> + }
> + }
> + }
> + else {
> + if (!stat(file, &statbuf)) {
> + IBND_DEBUG("file '%s' already exists\n", file);
> + return -1;
> + }
> }
Wouldn't it be better to make it in opposite direction - overwrite file
by default and drop an error when "exclusive" flag is specified?
For me it looks as more "intuitive" behavior (similar to other
editors).
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html