From 1cee71713f75dbee653ea86bd4e7c87efe677cf6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 31 May 2011 16:14:04 -0700 Subject: Change sys_getcd() to take no arguments and always return malloc'ed memory (or NULL). Part of the efforts to remove PATH_MAX on modern systems. --- source3/printing/print_generic.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index b925bedace..14f4c6dbe7 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -155,17 +155,17 @@ static int generic_job_submit(int snum, struct printjob *pjob) /* we print from the directory path to give the best chance of parsing the lpq output */ - current_directory = TALLOC_ARRAY(ctx, - char, - PATH_MAX+1); - if (!current_directory) { - return -1; - } - wd = sys_getwd(current_directory); + wd = sys_getwd(); if (!wd) { return -1; } + current_directory = talloc_strdup(ctx, wd); + SAFE_FREE(wd); + + if (!current_directory) { + return -1; + } print_directory = talloc_strdup(ctx, pjob->filename); if (!print_directory) { return -1; @@ -205,7 +205,7 @@ static int generic_job_submit(int snum, struct printjob *pjob) out: - if (chdir(wd) == -1) { + if (chdir(current_directory) == -1) { smb_panic("chdir failed in generic_job_submit"); } TALLOC_FREE(current_directory); -- cgit