mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 13:16:34 +00:00
scst_vdisk: Fix trailing whitespace removal code in vcdrom_change()
Stop looking for trailing whitespace when p == buffer. Remove the local
variable 'pp' since it always equals p + 1.
Fixes: f381dbb74c ("Device sysfs locking reconsidered to remove recently introduced deadlock possibility")
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9311 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -7664,7 +7664,7 @@ static int vcdrom_change(struct scst_vdisk_dev *virt_dev,
|
||||
char *buffer)
|
||||
{
|
||||
loff_t err;
|
||||
char *old_fn, *p, *pp;
|
||||
char *old_fn, *p;
|
||||
bool old_empty;
|
||||
struct file *old_fd;
|
||||
struct file *old_dif_fd;
|
||||
@@ -7688,16 +7688,16 @@ static int vcdrom_change(struct scst_vdisk_dev *virt_dev,
|
||||
|
||||
p = buffer;
|
||||
|
||||
/* Skip leading whitespace */
|
||||
while (isspace(*p) && *p != '\0')
|
||||
p++;
|
||||
filename = p;
|
||||
/* Strip trailing whitespace */
|
||||
WARN_ON_ONCE(length == 0);
|
||||
p = &buffer[length-1];
|
||||
pp = &buffer[length];
|
||||
while (isspace(*p) && (*p != '\0')) {
|
||||
pp = p;
|
||||
while (p > buffer && isspace(*p))
|
||||
p--;
|
||||
}
|
||||
*pp = '\0';
|
||||
p[1] = '\0';
|
||||
|
||||
res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_USER);
|
||||
if (res != 0)
|
||||
|
||||
Reference in New Issue
Block a user