Skip to content
  • Michael Hanselmann's avatar
    Fix off-by-one bug in job serial generation · 3c88bf36
    Michael Hanselmann authored
    Commit 009e73d0
    
     (September 2009) changed the job queue to generate
    multiple job serials at once. Ever since it would return one more than
    requested.
    
    The “serial” file in the job queue directory is defined to contain the
    “last job ID used” (design-2.0). With the change above, the serial file
    would always contain the next serial number. The first value returned by
    the generating function was the one contained in the file, so during the
    switch in 2009 one job may have been overwritten.
    
    This patch changes the code to always return the exact number of
    serials, to keep the last used serial on disk and adds an assertion.
    
    Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarIustin Pop <iustin@google.com>
    3c88bf36