[CRIU] [PATCH 6/9] files-reg: Strip off "(deleted)" postfix on ghost files

Pavel Emelyanov xemul at parallels.com
Fri Oct 17 05:02:29 PDT 2014


> @@ -623,9 +623,27 @@ static inline bool nfs_silly_rename(char *rpath, const struct fd_parms *parms)
>  	return (parms->fs_type == NFS_SUPER_MAGIC) && is_sillyrename_name(rpath);
>  }
>  
> -static int check_path_remap(char *rpath, int plen, const struct fd_parms *parms,
> +static void strip_deleted(struct fd_link *link)
> +{
> +	const char postfix[] = " (deleted)";
> +	const size_t plen = strlen(postfix);

Why not the sizeof(postfix) - 1?

> +
> +	if (link->len > plen) {
> +		size_t at = link->len - plen;
> +		if (!strcmp(&link->name[at], postfix)) {
> +			pr_debug("Stip %s' tag from '%s'\n",
> +				 postfix, link->name);
> +			link->name[at] = '\0';
> +			link->len -= plen;
> +		}
> +	}
> +}
> +



More information about the CRIU mailing list