PATCH: disk: report error if file file with same already exists while renaming.
Sameer Naik <[email protected]>
| Newsgroups | gmane.network.rdesktop.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, In the disk redirection, while renaming a file on the disk, if a file with the same name already exists, then it is simply overwritten. Attached patch signals a name collision to the server. The server displays an appropriate message notifying the session user of the condition. Thanks and Regards ~Sameer ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ rdesktop-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdesktop-devel
rdesktop-disk-file-renaming.patch
(text/x-patch, 487 B)
diff --git a/disk.c b/disk.c
index df9b433..61b4091 100644
--- a/disk.c
+++ b/disk.c
@@ -812,6 +812,10 @@ disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM ou
sprintf(fullpath, "%s%s", g_rdpdr_device[pfinfo->device_id].local_path,
newname);
+ /* check if a file with same name exists */
+ if (access (fullpath, F_OK) == 0)
+ return RD_STATUS_OBJECT_NAME_COLLISION;
+
if (rename(pfinfo->path, fullpath) != 0)
{
perror("rename");