diff --git a/interfaces/innerkits/native/file_share/src/file_share.cpp b/interfaces/innerkits/native/file_share/src/file_share.cpp index 087090dc0d31c0a9fedd2be37ba5372665c42701..fbbf7545831a303a5b048453b03a2f5bd7461641 100644 --- a/interfaces/innerkits/native/file_share/src/file_share.cpp +++ b/interfaces/innerkits/native/file_share/src/file_share.cpp @@ -118,6 +118,14 @@ static bool CheckIfNeedShare(ShareFileType type, const string &path) return true; } + if (buf.st_uid == 0) { + LOGD("Root file should be remove"); + if (remove(path.c_str()) != 0) { + LOGE("Remove file/dir failed, err %{public}d", errno); + } + return true; + } + if (buf.st_nlink != 0) { LOGI("no need create again"); return false;