Menu

#279 Use pathconf() instead of NAME_MAX

5.0.FC
fixed
nobody
None
enhancement
log
-
major
2016-01-27
2013-05-20
No

According to POSIX.1, neither PATH_MAX nor NAME_MAX have to be defined as constants (see Limits on File System Capacity). To be portable, a program should instead use pathconf() to determine the maximum limits.

LSB defines PATH_MAX but not NAME_MAX (see Data Definitions for libc). Therefore, the minimum requirement is that at least the use of the NAME_MAX constant is removed from the code.

Related

Tickets: #1686
Tickets: #279
Wiki: ChangeLog-5.0.0

Discussion

  • Anders Widell

    Anders Widell - 2013-05-31

    I noticed that the code in the log service contains constructs like this:

    char pathname[PATH_MAX + NAME_MAX];
    

    In the example above, NAME_MAX can simply be removed. The reason is that a pathname also includes the filename (unless it refers to a directory).

     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2015-10-14
    • status: unassigned --> accepted
    • assigned_to: Vu Minh Nguyen
    • Milestone: future --> 5.0
     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2016-01-21
    • status: accepted --> review
     
  • elunlen

    elunlen - 2016-01-27
    • status: review --> fixed
    • assigned_to: Vu Minh Nguyen --> nobody
     
  • elunlen

    elunlen - 2016-01-27

    changeset: 7262:bd45f18efb09
    tag: tip
    user: Vu Minh Nguyen vu.m.nguyen@dektech.com.au
    date: Thu Jan 21 09:47:49 2016 +0700
    summary: log: Use pathconf() instead of NAME_MAX [#279]

    rev: bd45f18efb09e1a4425e4c12dd6c93e784e9ffd1

     

    Related

    Tickets: #279


Log in to post a comment.