Revision b8fa22aa

b/xseg/peers/user/filed.c
438 438
        if (dst < 0) {
439 439
                fprintf(stderr, "fail in dst\n");
440 440
                fail(store, io);
441
		free(buf);
441 442
                return;
442 443
        }
443 444

  
......
445 446
        if (src < 0) {
446 447
                fprintf(stderr, "fail in src\n");
447 448
                fail(store, io);
449
		free(buf);
448 450
                return;
449 451
        }
450 452

  
......
465 467
        complete(store, io);
466 468

  
467 469
out:
470
	free(buf);
468 471
        close(src);
469 472
}
470 473

  
474
static void handle_delete(struct store *store, struct io *io)
475
{
476
	struct xseg_request *req = io->req;
477
	int fd;
478
	char *target = xseg_get_target(store->xseg, req);
479
	
480
	fd = dir_open(store, io, target, req->targetlen, 0);
481
	if (fd < 0) {
482
		fprintf(stderr, "fail in dir_open\n");
483
		fail(store, io);
484
		return;
485
	}
486

  
487
	/* 'invalidate' cache entry */
488
	if (io->fdcacheidx >= 0) {
489
		store->fdcache[io->fdcacheidx].fd = -1;
490
	}
491

  
492
	close(fd);
493
	char buf[MAX_FILENAME_SIZE + 1];
494
	strncpy(buf, target, req->targetlen);
495
	buf[req->targetlen] = 0;
496
	unlinkat(store->dirfd, buf, 0);
497

  
498
	complete(pfiled, io);
499

  
500
	return;
501
}
471 502

  
472 503
static void dispatch(struct store *store, struct io *io)
473 504
{
......
480 511
		handle_read_write(store, io); break;
481 512
	case X_INFO:
482 513
		handle_info(store, io); break;
514
	case X_DELETE:
515
		handle_delete(store, io); break;
483 516
	case X_COPY:
484 517
		handle_copy(store, io); break;
485 518
	case X_SYNC:

Also available in: Unified diff