Skip to content

Commit

Permalink
rename command - 长度检查
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeBriton committed Jan 7, 2024
1 parent d0093b3 commit 449a05d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ unsigned short iname(char *name){
printf("当前目录下已有与 %s 重名的\n", newname);
return;
}
if (strlen(newname) > DIRSIZ)
{
printf("新命名长度超过上限\n", newname);
return;
}
strcpy(dir.direct[i].d_name, newname);
return;
}
Expand Down

0 comments on commit 449a05d

Please sign in to comment.