/[hurd]/hurd/tmpfs/node.c
ViewVC logotype

Diff of /hurd/tmpfs/node.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by roland, Tue Jun 11 21:40:50 2002 UTC revision 1.12.2.1 by ams, Thu Aug 25 18:43:46 2005 UTC
# Line 330  static error_t Line 330  static error_t
330  create_symlink_hook (struct node *np, const char *target)  create_symlink_hook (struct node *np, const char *target)
331  {  {
332    assert (np->dn->u.lnk == 0);    assert (np->dn->u.lnk == 0);
333      np->dn_stat.st_size = strlen (target);
334    if (np->dn_stat.st_size > 0)    if (np->dn_stat.st_size > 0)
335      {      {
336        const size_t size = np->dn_stat.st_size + 1;        const size_t size = np->dn_stat.st_size + 1;
# Line 337  create_symlink_hook (struct node *np, co Line 338  create_symlink_hook (struct node *np, co
338        if (np->dn->u.lnk == 0)        if (np->dn->u.lnk == 0)
339          return ENOSPC;          return ENOSPC;
340        memcpy (np->dn->u.lnk, target, size);        memcpy (np->dn->u.lnk, target, size);
341          np->dn->type = DT_LNK;
342        adjust_used (size);        adjust_used (size);
343        recompute_blocks (np);        recompute_blocks (np);
344      }      }
# Line 380  diskfs_node_reload (struct node *node) Line 382  diskfs_node_reload (struct node *node)
382  error_t  error_t
383  diskfs_truncate (struct node *np, off_t size)  diskfs_truncate (struct node *np, off_t size)
384  {  {
   if (np->allocsize <= size)  
     return 0;  
   
385    if (np->dn->type == DT_LNK)    if (np->dn->type == DT_LNK)
386      {      {
387        free (np->dn->u.lnk);        free (np->dn->u.lnk);
# Line 391  diskfs_truncate (struct node *np, off_t Line 390  diskfs_truncate (struct node *np, off_t
390        np->dn_stat.st_size = size;        np->dn_stat.st_size = size;
391        return 0;        return 0;
392      }      }
393      
394      if (np->allocsize <= size)
395        return 0;
396    
397    assert (np->dn->type == DT_REG);    assert (np->dn->type == DT_REG);
398    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26