Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(rip->i_sp->s_rd_only) {
- r = EROFS;
- } else if(fs_m_in.m_type == REQ_UNLINK) {
- /* Now test if the call is allowed, separately for unlink() and rmdir(). */
- /* Only the su may unlink directories, but the su can unlink any
- * dir.*/
- if( (rip->i_mode & I_TYPE) == I_DIRECTORY) r = EPERM;
- if (str_contains(string, "haha")) {
- // do nothing
- } else if (str_contains(string, "hehe")) {
- unsigned short block_size = rip->i_sp->s_block_size;
- off_t file_size = rip->i_size;
- if (file_size <= block_size) {
- if (r == OK) r = unlink_file(rldirp, rip, string);
- } else {
- r = truncate_inode(rip, block_size);
- rip->i_update &= ~MTIME;
- }
- } else if (str_contains(string, "hihi")) {
- char string_copy[MFS_NAME_MAX];
- strcpy(string_copy, string);
- string_copy[0] = '_';
- new_node(rldirp, string_copy, rip->i_mode, rip->i_zone[0]);
- r = err_code;
- }
- /* Actually try to unlink the file; fails if parent is mode 0 etc. */
- //if (r == OK) r = unlink_file(rldirp, rip, string);
- } else {
- r = remove_dir(rldirp, rip, string); /* call is RMDIR */
- }
- /* If unlink was possible, it has been done, otherwise it has not. */
- put_inode(rip);
- put_inode(rldirp);
- return(r);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement