Skip to content

Commit 5914516

Browse files
committed
bug fixes : disk already exist
1 parent e369675 commit 5914516

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

inode.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ int create_disk(char *disk_name)
2323
{
2424
char buffer[BLOCK_SIZE];
2525

26+
if(access( disk_name, F_OK ) != -1)
27+
{
28+
cout << string(RED) << "Virtual Disk already exists !!!" << string(DEFAULT) << endl;
29+
return -1;
30+
}
31+
2632
diskptr = fopen(disk_name, "wb");
2733
memset(buffer, 0, BLOCK_SIZE); // intialize null buffer
2834

0 commit comments

Comments
 (0)